#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


Please Help Members By Posting Answers For Below Questions

Explain high-order bytes.

780


How do you sort filenames in a directory?

818


What is the use of a ‘’ character?

688


Tell us something about keyword 'auto'.

752


Why isn't any of this standardized in c? Any real program has to do some of these things.

756






Explain what is the difference between #include and #include 'file' ?

671


Why is c called c?

708


Explain what will the preprocessor do for a program?

689


What is the difference between a free-standing and a hosted environment?

754


What's the difference between constant char *p and char * constant p?

757


What is the difference between procedural and declarative language?

771


What is hungarian notation? Is it worthwhile?

807


Which function in C can be used to append a string to another string?

744


What does it mean when a pointer is used in an if statement?

704


What is union and structure in c?

721