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

main() { int i, j; scanf("%d %d"+scanf("%d %d", &i, &j)); printf("%d %d", i, j); } a. Runtime error. b. 0, 0 c. Compile error d. the first two values entered by the user

2 Answers   HCL,


#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  


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  


How we print the table of 2 using for loop in c programing?

14 Answers   HCL, Wipro,


#include<stdio.h> main() { register i=5; char j[]= "hello"; printf("%s %d",j,i); }

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  


write a program for area of circumference of shapes

0 Answers  


write a simple calculator c program to perform addition, subtraction, mul and div.

0 Answers   United Healthcare, Virtusa,


main() { show(); } void show() { printf("I'm the greatest"); }

2 Answers  


how many processes will gate created execution of -------- fork(); fork(); fork(); -------- Please Explain... Thanks in advance..!

8 Answers   GATE,


main() { int c = 5; printf("%d", main||c); } a. 1 b. 5 c. 0 d. none of the above

2 Answers   HCL,


main() { int i=5,j=10; i=i&=j&&10; printf("%d %d",i,j); }

1 Answers  


Categories