#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

Why does everyone say not to use gets?

597


What is volatile c?

509


Difference between Function to pointer and pointer to function

621


Which node is more powerful and can handle local information processing or graphics processing?

811


When should we use pointers in a c program?

616






how to build a exercise findig min number of e heap with list imlemented?

1599


in case any function return float value we must declare a) the function must be declared as 'float' in main() as well b) the function automatically returned float values c) function before declared 'float' keyword d) all the above

581


Should I learn data structures in c or python?

567


Explain what is a stream?

598


code for quick sort?

1604


Explain pointers in c programming?

623


write a program that reads lines(using getline), converts each line to an integer using atoi, and computes the average of all the numbers read. also compute the standard deviation.

1974


What is #include in c?

587


What is #define in c?

605


Write a progarm to find the length of string using switch case?

1597