#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

int a = 10 + 10 .... ,... A = A * A What would be the value of A? The answer is 120!! Could anyone explain this to me.

2 Answers   Bosch, eInfochips, HCL, IHCL,


main( ) { int a[2][3][2] = {{{2,4},{7,8},{3,4}},{{2,2},{2,3},{3,4}}}; printf(ā€œ%u %u %u %d \nā€,a,*a,**a,***a); printf(ā€œ%u %u %u %d \nā€,a+1,*a+1,**a+1,***a+1); }

2 Answers  


write a program to count the number the same (letter/character foreg: 's') in a given sentence.

2 Answers  


Which one is taking more time and why ? :/home/amaresh/Testing# cat time.c //#include <stdio.h> #define EOF -1 int main() { register int c; while ((c = getchar()) != EOF) { putchar(c); } return 0; } ------------------- WIth stdio.h:- :/home/amaresh/Testing# time ./time_header hi hi hru? hru? real 0 m4.202s user 0 m0.000s sys 0 m0.004s ------------------ Witout stdio.h and with #define EOF -1 =================== /home/amaresh/Testing# time ./time_EOF hi hi hru? hru? real 0 m4.805s user 0 m0.004s sys 0 m0.004s -- From above two case , why 2nd case is taking more time ?

0 Answers  


Cau u say the output....?

1 Answers  






Finding a number multiplication of 8 with out using arithmetic operator

8 Answers   Eyeball, NetApp,


main() { unsigned int i=10; while(i-->=0) printf("%u ",i); }

2 Answers   HP,


print a semicolon using Cprogram without using a semicolon any where in the C code in ur program!!

35 Answers   Tata Elxsi, TCS, VI eTrans,


Design an implement of the inputs functions for event mode

0 Answers   Wipro,


#include<stdio.h> int main() { int a=3,post,pre; post= a++ * a++ * a++; a=3; pre= ++a * ++a * ++a; printf("post=%d pre=%d",post,pre); return 0; }

3 Answers  


Write out a function that prints out all the permutations of a string. For example, abc would give you abc, acb, bac, bca, cab, cba. You can assume that all the characters will be unique.

5 Answers   IITR, Microsoft, Nike,


int i=10; main() { extern int i; { int i=20; { const volatile unsigned i=30; printf("%d",i); } printf("%d",i); } printf("%d",i); }

1 Answers  


Categories