2,329 views

2 Answers

Best answer
7 7 votes
foo(2.5);
foo(2) // converting 2.5 into int

now case 2 is true so it will print *.
case 3 will also print * because no break statement.
default case will also print *.

TOtal 3 time * will be printed.
• selected by
0 0 votes
x=2.5 after converting int x will 2

so * is prited 3 times (one for case 2 ,one for case 3 because no break statement is used here and one for default).
Answer:
Position:
Show:

Related questions

13 13 votes
1 answers 1 answer
3.5k
3.5k views
Arjun asked Oct 18, 2016
3,471 views
#include <stdio.h int foo(int a[100]) { return sizeof(a); } int main() { int a[10]; printf("%d", foo(a)); }What will be the output of the above code ignoring any compiler...
7 7 votes
4 answers 4 answers
3.5k
3.5k views
Arjun asked Oct 18, 2016
3,474 views
The output of the following C program will be _____#include<stdio.h #define type int type foo(type b) { return b*b; } #undef type #define type float int main() { float a ...
3 3 votes
4 answers 4 answers
1.6k
1.6k views
Arjun asked Oct 18, 2016
1,592 views
What will be the output of the following code?#include <stdio.h int main() { char a = 'A', z = 'Z'; printf("%d", z-a); }
2 2 votes
5 answers 5 answers
3.1k
3.1k views
Arjun asked Oct 18, 2016
3,063 views
The value returned by the following code is _____int foo() { int a[] = { 10, 20, 30, 40, 50, 60 }; int *p = &a , *q = &a[5] ; return q-p; }