Top

Discussion

What will be the output of the following C code?

#include
enum hi{a,b,c};
enum hello{c,d,e};
main()
{
    enum hi h;
    h=b;
    printf("%d",h);
    return 0;
}

 

  • A.2
  • B.1
  • C.Error

Answer: C

The code shown above results in an error: re-declaration of enumerator ‘c’. All enumerator constants should be unique in their scope.

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

Post your comment