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

How can u say that a given point is in a triangle? 1. with the co-ordinates of the 3 vertices specified. 2. with only the co-ordinates of the top vertex given.

1 Answers  


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

2 Answers   HP,


What is data _null_? ,Explain with code when u need to use it in data step programming ?

0 Answers   Abbott,


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

7 Answers  


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

1 Answers  






1) int i=5; j=i++ + i++ + i++; printf("%d",j);This code gives the answer 15.But if we replace the value of the j then anser is different?why? 2)int i=5; printf("%d",i++ + i++ + i++); this givs 18.

8 Answers   IBPS, Infosys, TCS,


Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it.

9 Answers   Microsoft,


Can you send Code for Run Length Encoding Of BMP Image in C Language in linux(i.e Compression and Decompression) ?

0 Answers   Honeywell,


typedef struct error{int warning, error, exception;}error; main() { error g1; g1.error =1; printf("%d",g1.error); }

1 Answers  


Is the following code legal? void main() { typedef struct a aType; aType someVariable; struct a { int x; aType *b; }; }

1 Answers  


1. const char *a; 2. char* const a; 3. char const *a; -Differentiate the above declarations.

3 Answers  


main() { char *a = "Hello "; char *b = "World"; clrscr(); printf("%s", strcpy(a,b)); } a. “Hello” b. “Hello World” c. “HelloWorld” d. None of the above

4 Answers   Corporate Society, HCL,


Categories