#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
Does c have circular shift operators?
Why we not create function inside function.
What is context in c?
What are the 4 types of programming language?
What do you mean by invalid pointer arithmetic?
How do you list a file’s date and time?
Can we declare variable anywhere in c?
write a program in C that prompts the user for today's date,tomorrow's date and display the results.Use structures for today's date,tomorrow's date and an array to hold the days for each month of the year.
Write a program to know whether the input number is an armstrong number.
Why do we use static in c?
What is indirection? How many levels of pointers can you have?
Why is c still so popular?
What happens if a header file is included twice?
What is the stack in c?
What functions are used in dynamic memory allocation in c?