Discussion
Point out the error (if any) in the following C code?
#include <stdio.h>
enum hello
{
a,b,c;
};
main()
{
enum hello m;
printf("%d",m);
}
Answer: B
Correct answer: Error in the statement: a,b,c;
The enumerator list must not end with a semicolon inside the braces - a, b, c is a comma-separated list, and the only semicolon belongs after the closing brace. Writing a,b,c; is a syntax error.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development