Programming Languages C Objective
Mar 09, 2013

What will be output of the following c code?

#define PRINT printf("c");printf("c++");
void main()
 {
  float a=5.5;
  if(a==5.5)
  PRINT
else
 printf("Not equal");
}

Choose the correct answer:
A) c c++
B) Not equal
C) c
D) Compiler error
Detailed Explanation

First see intermediate file:
try.c 1:
try.c 2: void main(){
try.c 3: float a=5.5;
try.c 4: if(a==5.5)
try.c 5: printf("c");printf("c++");
try.c 6: else
try.c 7: printf("Not equal");
try.c 8: }
try.c 9:
try.c 10:

If there are more than one statement in if block then it is necessary to write inside the { } otherwise it will show compiler error: misplaced else

Discussion (0)

No comments yet. Be the first to share your thoughts!

Share Your Thoughts
Feedback