Seja o seguinte programa: int maior ( int a, int b ) { int x; if ( b > a ) x = b; elsen x = a; return x: } int main ( ) { int a = 4, b = ; printf ( "%d ", maior ( 3 , 2 ) ); printf ( "%d ", maior ( maior ( 5 , 7 ), 9 ) ); printf ( "%d ", maior ( a , b ) ); printf ( "%d ", maior ( a + b , a - b) ); } Qual é a saída deste programa?
Soluções para a tarefa
Resposta:
main.c: In function ‘maior’:
main.c:5:5: error: unknown type name ‘elsen’
elsen x = a;
^~~~~
main.c:5:11: error: redeclaration of ‘x’ with no linkage
elsen x = a;
^
main.c:2:9: note: previous declaration of ‘x’ was here
int x;
^
main.c:6:13: error: expected ‘;’ before ‘:’ token
return x:
^
main.c: In function ‘main’:
main.c:10:20: error: expected expression before ‘;’ token
int a = 4, b = ;
^
main.c:11:5: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
printf ( "%d ", maior ( 3 , 2 ) );
^~~~~~
main.c:11:5: warning: incompatible implicit declaration of built-in function ‘printf’
main.c:11:5: note: include ‘’ or provide a declaration of ‘printf’
Explicação: