#include
main()
{
int i=1,j=2;
switch(i)
{
case 1: printf("GOOD");
break;
case j: printf("BAD");
break;
}
}
Answer Posted / surenda pal singh chouhan
Compiler Error: Constant expression required in function
main.
Explanation:
The case statement can have only constant expressions (this
implies that we cannot use variable names directly so an
error).
Note:
Enumerated types can be used in case statements.
Is This Answer Correct ? | 10 Yes | 2 No |
Post New Answer View All Answers
Explain high-order bytes.
How do you sort filenames in a directory?
What is the use of a ‘ ’ character?
Tell us something about keyword 'auto'.
Why isn't any of this standardized in c? Any real program has to do some of these things.
Explain what is the difference between #include and #include 'file' ?
Why is c called c?
Explain what will the preprocessor do for a program?
What is the difference between a free-standing and a hosted environment?
What's the difference between constant char *p and char * constant p?
What is the difference between procedural and declarative language?
What is hungarian notation? Is it worthwhile?
Which function in C can be used to append a string to another string?
What does it mean when a pointer is used in an if statement?
What is union and structure in c?