main()

{

float i=1.5;

switch(i)

{

case 1: printf("1");

case 2: printf("2");

default : printf("0");

}

}

Answers were Sorted based on User's Feedback



main() { float i=1.5; switch(i) { case 1: printf("1&quo..

Answer / susie

Answer :

Compiler Error: switch expression not integral

Explanation:

Switch statements can be applied only to integral types.

Is This Answer Correct ?    15 Yes 2 No

main() { float i=1.5; switch(i) { case 1: printf("1&quo..

Answer / mina

Compiler Error.
switch operates only with char and int.

Is This Answer Correct ?    3 Yes 0 No

Post New Answer

More C Code Interview Questions

#define square(x) x*x main() { int i; i = 64/square(4); printf("%d",i); }

4 Answers   Google, HCL, Quick Heal, WTF,


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

1 Answers   Zoho,


struct point { int x; int y; }; struct point origin,*pp; main() { pp=&origin; printf("origin is(%d%d)\n",(*pp).x,(*pp).y); printf("origin is (%d%d)\n",pp->x,pp->y); }

1 Answers  


‎#define good bad main() { int good=1; int bad=0; printf ("good is:%d",good); }

2 Answers  


Write a program to receive an integer and find it's octal equivalent. How can i do with using while loop.

2 Answers  






void main() { int i=5; printf("%d",i++ + ++i); }

3 Answers  


main() { int i =0;j=0; if(i && j++) printf("%d..%d",i++,j); printf("%d..%d,i,j); }

1 Answers  


#define a 10 void foo() { #undef a #define a 50 } int main() { printf("%d..",a); foo(); printf("%d..",a); return 0; } explain the answer

1 Answers  


int i; main(){ int t; for ( t=4;scanf("%d",&i)-t;printf("%d\n",i)) printf("%d--",t--); } // If the inputs are 0,1,2,3 find the o/p

2 Answers  


Give a very good method to count the number of ones in a 32 bit number. (caution: looping through testing each bit is not a solution)

7 Answers   Microsoft,


write a c program to Create a mail account by taking the username, password, confirm password, secret_question, secret_answer and phone number. Allow users to register, login and reset password(based on secret question). Display the user accounts and their details .

2 Answers  


main() { int a[10]; printf("%d",*a+1-*a+3); }

1 Answers  


Categories