How to make a C state machine using decision commands ( if , else ) to cycle through a buffer received from the internet, byte by byte, in order to find the first line breaks (% ), and only then write the content? The socket part is...
I'm doing an application in which I need to send via an external hardware an array of characters (declared as unsigned char ) that contains commands and times.
With the commands I have no problem, since each command corresponds to a...
My code looks like this:
#include <stdio.h>
int main()
{
unsigned long int L, N;
scanf("%lu%lu", &L, &N);
printf("%lu\n", (L-(N-1))*(L-(N-1)) + (N-1));
return 0;
}
When the test case has low numbers, the pro...
Is there any difference in the use of these 3 statements?
void addCliente(struct cliente *dadosCliente){
dadosCliente[k].nome="oi";
(*(dadosCliente+k)).nome="oi";
(dadosCliente+k)->nome="oi";
}
void main(){
struct cliente cl...
I'm doing a C navet game, so I need to put a large number of projectiles in a vector.
These projectiles have at least one position and speed to do calculations, and I'm trying to figure out how best to save them in memory for later use.
So...
I'm doing a school job, doing a blackjack (21) in C. In a certain part of the program, I created a while (while the option is yes) to show the cards, the score and ask if the user wants to bet again (yes or no) at the end of the while. Except th...
I made the following command:
for(int i = 1 ; i <= 3 ; i++) {etc
}
So I gave the following error when I compiled:
game.c:11:2: error: "for" loop initial declarations are only allowed in C99 mode
for(int i = 1 ; i <= 3 ; i++) {
/\ //...
Good morning, I would like to know, because my calculator program is not printing the value of the operations? Below is the code:
#include <stdio.h>
int main (void)
{
float A, B;
char op;
scanf("%f", &A);
scanf("%...
I'm studying a book I found on the net, she asks for an exercise, but she did not teach how to do it in the previous pages, I tried and it did not work, thank you for your help.
Make a program that reads and stores any two integers in varia...
I want to remove spaces from a string , example:
Pedro Henrique Ribeiro
I would stay:
Pedrohenriqueribeiro
The code I made, removes the space, but duplicates a letter:
#include <stdlib.h>
#include <stdio.h>
#include <...