Questions tagged as 'c'

0
answers

State machine that finds the first line breaks, in C [closed]

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...
asked by 19.06.2015 / 15:28
1
answer

Sending characters through the serial port including zero-value bytes

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...
asked by 12.11.2014 / 01:31
2
answers

Big integer does not work

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...
asked by 11.02.2016 / 22:50
1
answer

What's the difference between these ways of indexing a pointer to array of structs in c?

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...
asked by 04.02.2014 / 17:27
4
answers

What is the fastest, most memory-efficient type?

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...
asked by 30.01.2014 / 01:06
3
answers

Program does not read scanf

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...
asked by 12.12.2014 / 16:28
3
answers

Error in variable declaration in loop

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++) { /\ //...
asked by 18.09.2015 / 01:14
5
answers

Problem with calculator program

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("%...
asked by 28.04.2015 / 16:10
3
answers

How do you find the rest of the division?

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...
asked by 22.09.2015 / 15:26
3
answers

How to remove spaces from a string in C?

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 <...
asked by 06.05.2016 / 16:19