Top

Discussion

What will be the output of the following C code?

#include
enum sanfoundry
{
    a,b,c=5
};
int main()
{
    enum sanfoundry s;
    b=10;
    printf("%d",b);
}

 

  • A.Error
  • B.10
  • C.1
  • D.4

Answer: A

The above code results in an error. This is because it is not possible to change the values of enum constants. In the code shown above, the statement: b=10; causes the error.

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

Post your comment