Top

Discussion

Point out the error (if any) in the following C code?

#include
enum hello
{
    a,b,c;
};
main()
{
    enum hello m;
    printf("%d",m);
}

 

  • A.No error
  • B.Error in the statement: a,b,c;
  • C.Error in the statement: enum hello m;
  • D.Error in the statement: printf(“%d”,m);

Answer: B

In the above code, there is a semi colon given at the end of the list of variables. This results in an error. Semi colon is to be put only after the closing brace of the enum, not after the list of variables.

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

Post your comment