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

Is the following code legal? struct a { int x; struct a *b; }

2 Answers  


main() { float me = 1.1; double you = 1.1; if(me==you) printf("I love U"); else printf("I hate U"); }

1 Answers  


how to delete an element in an array

2 Answers   IBM,


write a c-program to find gcd using recursive functions

5 Answers   HTC, Infotech,


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

4 Answers  






main() { float i=1.5; switch(i) { case 1: printf("1"); case 2: printf("2"); default : printf("0"); } }

2 Answers  


main() { int c=- -2; printf("c=%d",c); }

1 Answers   TCS,


Write a program to implement the motion of a bouncing ball using a downward gravitational force and a ground-plane friction force. Initially the ball is to be projected in to space with a given velocity vector

2 Answers  


main() { while (strcmp(“some”,”some\0”)) printf(“Strings are not equal\n”); }

1 Answers  


¦void main() ¦{ ¦int i=10,j; ¦ j=i+++i+++i; ¦printf("%d",j); ¦getch(); ¦} ¦ output:-30 but in same question if we write as- ¦void main() ¦{ ¦int i=10; ¦ int j=i+++i+++i; ¦printf("%d",j); ¦getch(); ¦} ¦ output:-33 why output is changed from 30 to 33. Can any body answer...

3 Answers  


1 o 1 1 0 1 0 1 0 1 1 0 1 0 1 how to design this function format in c-language ?

2 Answers  


main() { int a=10,*j; void *k; j=k=&a; j++; k++; printf("\n %u %u ",j,k); }

1 Answers  


Categories