Top

Discussion

What will be the output of the following C code?

#include
enum sanfoundry
{
    a=1,b
};
enum sanfoundry1
{
    c,d
};
int main()
{
    enum sanfoundry1 s1=c;
    enum sanfoundry1 s=a;
    enum sanfoundry s2=d;
    printf("%d",s);
    printf("%d",s1);
    printf("%d",s2);
}

 

  • A.Error
  • B.011
  • C.110
  • D.101

Answer: D

The output of the code shown above is 101. This code shows that it is possible to store the symbol of one enum in another enum variable.

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

Post your comment