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
Answer / susie
Answer :
Compiler Error: switch expression not integral
Explanation:
Switch statements can be applied only to integral types.
| Is This Answer Correct ? | 16 Yes | 2 No |
Answer / mina
Compiler Error.
switch operates only with char and int.
| Is This Answer Correct ? | 3 Yes | 0 No |
write a c program to print magic square of order n when n>3 and n is odd?
how to print 1 2 3 4 5 6 7 8 9 10 9 8 7 6 5 4 3 2 1 using any loop(for or while) only once(only 1 loop) and maximum 2 variables using C.
19 Answers Cap Gemini, Infosys,
main() { unsigned char i=0; for(;i>=0;i++) ; printf("%d\n",i); }
write a c program to input initial & final time in the format hh:mm and find the time intervel between them? Ex inputs are initial 06:30 final 00:05 and 23:22 final 22.30
void main() { int i=i++,j=j++,k=k++; printf(“%d%d%d”,i,j,k); }
void main() { int x,y=2,z; z=(z*=2)+(x=y=z); printf("%d",z); }
main() { int i=1; while (i<=5) { printf("%d",i); if (i>2) goto here; i++; } } fun() { here: printf("PP"); }
Code for 1>"ascii to string" 2>"string to ascii"
1 Answers Aricent, Global Logic,
union u { struct st { int i : 4; int j : 4; int k : 4; int l; }st; int i; }u; main() { u.i = 100; printf("%d, %d, %d",u.i, u.st.i, u.st.l); } a. 4, 4, 0 b. 0, 0, 0 c. 100, 4, 0 d. 40, 4, 0
int a=1; printf("%d %d %d",a++,a++,a); need o/p in 'c' and what explanation too
main( ) { void *vp; char ch = ‘g’, *cp = “goofy”; int j = 20; vp = &ch; printf(“%c”, *(char *)vp); vp = &j; printf(“%d”,*(int *)vp); vp = cp; printf(“%s”,(char *)vp + 3); }
Is the following statement a declaration/definition. Find what does it mean? int (*x)[10];