Questions tagged as 'c'

1
answer

preecher array, struct in C?

How do I fill leds and seq without needing a for loop? int main() { struct ledvalue { int seq[10]; int leds[10]; }; struct ledvalue numbers; numbers.seq={0,1,2,3,4,5,6,7,8,9}; numbers....
asked by 11.03.2017 / 01:40
1
answer

Doubt in code C data structure

Good afternoon, well I'm here to see if anyone knows why my code is printing a memory garbage, when it executes it shows what I want but printa trash of memory, if anyone knows why I thank #include <stdio.h> #include <stdlib.h&g...
asked by 08.03.2017 / 19:48
1
answer

Why can not I change a variable in C by performing an arithmetic operation with it? [closed]

I'm not getting the expected result: libraries ... int main (void){ float c,r; setlocale(LC_ALL,""); printf("Digite o salário\n"); scanf("%f",&c); printf("Digite o reajuste percentual:\n"); scanf("%f",&r);...
asked by 03.04.2017 / 03:43
1
answer

How to work with Dates in C?

Talk to your people! I got a question here on the internet to make it come out nothing at all. It asks for the following: Do you want to make a program that reads the name of the book that will be borrowed, the type of (student or teacher) and t...
asked by 15.04.2017 / 14:24
1
answer

I can not pass one vector per parameter in C

I'm trying to pass one vector per parameter to a function in C, but I'm experiencing difficulties. #include <stdio.h> #include <stdlib.h> #include <math.h> void calculafx( x2, *f3, *f4, m){ int j; float fx1=0; for(j...
asked by 18.02.2017 / 15:29
1
answer

sprintf does not give the expected result

I have variables of type Unsigned Long Int and would like to save its value in string , to perform checksum and send via serial communication.     void Payload (int long unsigned lastTime, float deltaOne, float deltaTwo, int factor...
asked by 16.02.2017 / 12:36
1
answer

Insert element Row C

How do I "Insert an element (returning 1 if the insertion has succeeded, and -1 otherwise) in a Row" I did this, what is missing: void enfilerar(tipo_fila *fila, int valor) { if (fila->fim<TAM_FILA) { fila->fim++;...
asked by 27.03.2017 / 13:51
2
answers

Generation of random numbers [duplicate]

I declare a method to generate random numbers, but the results are almost always the same, why? int geraAleatorio(int min, int max) { return ((rand() % (max - min)) + min) + 1; } Is there any other algorithm?     
asked by 25.02.2017 / 23:11
1
answer

Error loading file for threaded list

This code loads elements of a .txt file, but apparently it can load the information from the file, but it gives some error in inserting the list, but I can not identify it. Here is the code and file information: #include<stdio.h> #includ...
asked by 18.03.2017 / 06:11
1
answer

Two readers on arduino

As this code I read the card and inform if it is registered or not. Now I need to insert two rfid readers into the Arduino. How to add the second rfid reader in this code? include SPI.h include MFRC522.h define LED_VERDE 6 define LED_VERMELHO...
asked by 17.03.2017 / 10:42