1,150 views

2 Answers

Best answer
5 votes
5 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 votes
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:

Related questions

3 votes
3 votes
4 answers
1
Arjun asked Oct 18, 2016
774 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 votes
2 votes
5 answers
2
Arjun asked Oct 18, 2016
1,571 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; }
12 votes
12 votes
1 answer
3
7 votes
7 votes
3 answers
4
Arjun asked Oct 18, 2016
1,585 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 ...