Top

Discussion

What will be the output of the following C code?

#include
#define MAX 4
enum sanfoundry
{
    a,b=3,c
};
main()
{
    if(MAX!=c)
        printtf("hello");
    else
        printf("welcome");
}

 

  • A.error
  • B.hello
  • C.welcome
  • D.2

Answer: C

The output will be welcome. The value of the macro MAX is 4. Since 4 is equal to the value of c, welcome is printed.

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

Post your comment