Questions tagged as 'c'

2
answers

Modifiers int, unsigned and signed in C language

Algorithm "handle age": // idade deve sempre ser positiva, por isso vou usar unsigned unsigned int t1; printf("Digite sua idade:"); scanf("%d", &t1); printf("Idade: %d", t1); Doubt: Even though I enter with a negative value, 2 printf...
asked by 21.10.2017 / 02:39
3
answers

How could I read a 3-digit value and print them on the screen inverted in C?

If I store the value '123' in an integer variable, how could I print the contents of the variable on the screen inverted? For example, for the value '123' the expected output would be '321'; for '472' would be '274'.     
asked by 14.10.2017 / 17:17
1
answer

What is the most up-to-date version of the C language and which compiler works best?

What is the most up-to-date version of C and which compiler works best?     
asked by 07.09.2018 / 17:49
1
answer

C / How to change the for for a while?

Write the function prints using the while repeat structure instead of for. If necessary I can edit and insert all the code. void imprime(Ccc *p) { Ccc *r; for (r = p; r!=NULL; r = r->proximo) printf("%c",r->caracter); }...
asked by 29.08.2018 / 14:25
1
answer

Using pointer can make my code faster?

I was told that if I work using pointers the program will be faster. If instead of using index to traverse a vector I use the pointer, does it get better?     
asked by 30.07.2018 / 20:40
2
answers

Loop problem with switch case

I have refactored the code following the guidelines given here. However, I have the initial problem again ... I choose the desired option, it performs the desired action but then goes to the default case switch and prints "invalid information"...
asked by 24.07.2018 / 18:07
2
answers

Qsort sorting wrongly

My activity and read a phrase and sorted in alphabetical order, but it is giving error #include <stdio.h> #include <stdlib.h> #include <string.h> int ordena(const void * a, const void * b) { return strcmp((char *)a, (char...
asked by 23.05.2018 / 00:40
1
answer

Why is the size of the vector being changed in the function?

Tanho comes as 2, when passed the tamVet () #include <stdio.h> int tamVet(int *vet){ int tam; tam = sizeof(vet) / sizeof(vet[0]); return tam; } int main(void){ int vetor[10]; int tam = tamVetor(vetor); printf("%i", tam); }...
asked by 10.08.2018 / 01:13
1
answer

What is a recursive method?

Is the resultado variable within for recursive? #include <stdio.h> int main(void) { int N,i; double resultado=0.0; scanf("%d",&N); for (i=0; i<N; i++) { resultado= 1.0 / (resultado+2); } printf("%0.10lf...
asked by 21.08.2018 / 20:16
3
answers

Use of while within if

I have to read endless averages of students and if they are greater than or equal to 7 the student is approved, if not, he is disapproved, and if I type -1 the program stops and issues a closing message. > I'm trying hard to make this program...
asked by 22.08.2018 / 21:29