Top

Discussion

What is the output of this C code?
 

#define a 20
int main()
{
const int a = 50;
printf("a = %d\n", a);
}

 

  • A.a = 50
  • B.a = 20
  • C.Run time error
  • D.Compilation Error

Answer: D

The #define substitutes a with 20 leaving no identifier and hence compilation error.
Complilation Error: expected identifier or ‘(’ before numeric constant

No comment is present. Be the first to comment.
Loading…

Post your comment