#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 the meaning of keyword 'extern' in a function declaration.
What is the translation phases used in c language?
In a header file whether functions are declared or defined?
How can I remove the trailing spaces from a string?
a c code by using memory allocation for add ,multiply of sprase matrixes
How can I avoid the abort, retry, fail messages?
What will the code below print when it is executed? int x = 3, y = 4; if (x = 4) y = 5; else y = 2; printf ("x=%d, y=%d ",x,y);
Can we change the value of static variable in c?
Explain the use of function toupper() with and example code?
Why use int main instead of void main?
How can I get the current date or time of day in a c program?
In a switch statement, what will happen if a break statement is omitted?
What is wrong with this program statement? void = 10;
What is the size of enum in c?
How are structure passing and returning implemented?