#include<stdio.h>

main()

{

int i=1,j=2;

switch(i)

{

case 1: printf("GOOD");

break;

case j: printf("BAD");

break;

}

}



#include<stdio.h> main() { int i=1,j=2; switch(i) ..

Answer / susie

Answer :

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 ?    3 Yes 0 No

Post New Answer

More C Code Interview Questions

/*what is the output for*/ void main() { int r; printf("Naveen"); r=printf(); getch(); }

4 Answers  


How do you create a really large matrix (i.e. 3500x3500) in C without having the program crash? I can only reach up to 2500. It must have something to do with lack of memory. Please help!

1 Answers  


void func1(int (*a)[10]) { printf("Ok it works"); } void func2(int a[][10]) { printf("Will this work?"); } main() { int a[10][10]; func1(a); func2(a); } a. Ok it works b. Will this work? c. Ok it worksWill this work? d. None of the above

1 Answers   HCL,


Write a C function to search a number in the given list of numbers. donot use printf and scanf

5 Answers   Honeywell, TCS,


why java is platform independent?

13 Answers   Wipro,






Write a C program that defines a 2-dimentional integer array called A [50][50]. Then the elements of this array should randomly be initialized either to 1 or 0. The program should then print out all the elements in the diagonal (i.e. a[0][0], a[1][1],a[2][2], a[3][3], ……..a[49][49]). Finally, print out how many zeros and ones in the diagonal.

2 Answers  


main() { char c; int i = 456; clrscr(); c = i; printf("%d", c); } a. 456 b. -456 c. random number d. none of the above

3 Answers   BrickRed, HCL,


What is wrong with the following code? int *foo() { int *s = malloc(sizeof(int)100); assert(s != NULL); return s; }

1 Answers  


Display the time of the system and display the right time of the other country

1 Answers  


plz send me all data structure related programs

2 Answers  


main() { int i=0; for(;i++;printf("%d",i)) ; printf("%d",i); }

1 Answers   Zoho,


Write a C program to print ‘Campus Force training’ without using even a single semicolon in the program.

3 Answers   Wipro,


Categories