Top

Discussion

What is the output of this program?

#include 
#define i 5
int main()
{
  #define i 10
  printf("%d",i);
  return 0;
}

 

  • A.Compilation error
  • B.10
  • C.5
  • D.Runtime error

Answer: B

The preprocessor directives can be redefined anywhere in the program. So the most recently assigned value (#define i 10) will be taken.

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

Post your comment