Conditional Sample
main()
{ int a-300,b=200,c;
if(!a>-200) b=300;
C-400;
printf("b=%d c-%d", b, c);
}
Question Referring to the conditional sample above, what is the output of the program?
Answers
Answer:
Syntex error
Explanation:
i think there would be Syntex error cause that if condition looks wrong to me but it also depends on language.
Answer: Syntax error
Explanation: As the output of the given program is
prog.c:1:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
1 | main()
| ^~~~
prog.c: In function ‘main’:
prog.c:3:8: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘-’ token
3 | { int a-300,b=200,c;
| ^
prog.c:3:13: error: ‘b’ undeclared (first use in this function)
3 | { int a-300,b=200,c;
| ^
prog.c:3:13: note: each undeclared identifier is reported only once for each function it appears in
prog.c:3:12: warning: left-hand operand of comma expression has no effect [-Wunused-value]
3 | { int a-300,b=200,c;
| ^
prog.c:3:19: error: ‘c’ undeclared (first use in this function)
3 | { int a-300,b=200,c;
| ^
prog.c:3:18: warning: left-hand operand of comma expression has no effect [-Wunused-value]
3 | { int a-300,b=200,c;
| ^
prog.c:5:5: error: ‘a’ undeclared (first use in this function)
5 | if(!a>-200) b=300;
| ^
prog.c:7:1: error: ‘C’ undeclared (first use in this function)
7 | C-400;
| ^
prog.c:9:1: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
9 | printf("b=%d c-%d", b, c);
| ^~~~~~
prog.c:9:1: warning: incompatible implicit declaration of built-in function ‘printf’
prog.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
+++ |+#include <stdio.h>
1 | main()
#SPJ3