Questions tagged as 'c'

2
answers

Exit multiple loops without using goto

Oops! The title says it all! Does anyone know an interesting way to get out of more than one loop without using goto?     
asked by 13.08.2016 / 05:16
2
answers

How to modify the contents of a root using a pointer?

How to modify the contents of a root using a pointer?    Type a code in C that uses a variable named 'root', has the type 'float' and has the initial value number 3.1415.       In this same code, use another variable named 'point_to_race' to...
asked by 20.08.2018 / 20:58
2
answers

Storing Strings in Vectors - C

How do I store more than one name in a variable of type char , why put it, let's assume name [20] , I'm defining that it has received 20 characters, not that it can receive 20 elements, the code I'm trying to test, that's it here. #include...
asked by 31.10.2018 / 16:42
2
answers

Program termination condition in C!

I have a program in C where the output should be the average of the numbers entered and how many of those values that were entered are larger than the average. The program receives up to 100 F values, where F is a positive value between 0 and...
asked by 08.11.2018 / 05:55
4
answers

Print strings in alphabetical order

I'm trying to do here because the user provides 3 names at least so I have to sort those names alphabetically, I had tried with strcmp , but I did not quite understand the concept of this command. So I used the following code: char nm1[2...
asked by 02.07.2015 / 19:14
3
answers

Function prints list while

How do I do this with the loop while ? void imprime(lista* recebida){ lista* aux; for(aux=recebida; aux!=NULL; aux=aux->prox){ printf("Informacao %d\n",aux->info); } }     
asked by 18.04.2017 / 19:12
1
answer

How do I stop organizing the table in while?

How do I stop organizing this table? Sum, subtraction and multiplication respectively? #include <stdio.h> int main (){ int i=0, num=0; printf ("Digite um n£mero: "); scanf ("%d",&num); printf ("\n"); while (i<=9){ i++;...
asked by 21.10.2017 / 18:08
2
answers

Why can I pass a vector of char to the scanf as an address or a direct variable?

If the vector name or array is already the address of the first element, why in scanf() , using the primitive types ( int , char , float , double ) I need to pass the address, and when we want to read a string (...
asked by 02.11.2017 / 15:46
2
answers

Find the smallest value in vector recursively

My recursive function needs to return the smallest vector, only it is always returning 0. What is wrong with my logic? My role: int menor(int vet[], int i) { int m=0; if(vet[i] == 0) { m=vet[i]; return m; } if( vet[i] < m) {...
asked by 29.06.2018 / 19:34
1
answer

Why does this work? pointer = (struct a *) & b;

struct a { int a; int b; }; struct b { int a; int b; }; struct a *ponteiroa; struct b b; b.b = 20; ponteiroa = &b; //Isto não dá certo ponteiroa = (struct a *)&b; Why does this (struct a *)&b work? Why c...
asked by 19.09.2018 / 23:59