f1()
{
f(3);}
f(int t)
{
switch(t);
{
case 2: c=3;
case 3: c=4;
case 4: c=5;
case 5: c=6;
default: c=0;}
value of c?

Answers were Sorted based on User's Feedback



f1() { f(3);} f(int t) { switch(t); { case 2: c=3; case 3: c=4; case 4: c=5; case 5: c=6; ..

Answer / ningappa

The above code returns a compiler error:

1.In C functions cannot be made inline.
2.A semi-colon is not expected after switch.

Is This Answer Correct ?    7 Yes 0 No

f1() { f(3);} f(int t) { switch(t); { case 2: c=3; case 3: c=4; case 4: c=5; case 5: c=6; ..

Answer / madhu

As t = 3,it goes to case 3.But there is no break in that
case so it proceeds further down to default and c becomes 0.

Is This Answer Correct ?    7 Yes 1 No

f1() { f(3);} f(int t) { switch(t); { case 2: c=3; case 3: c=4; case 4: c=5; case 5: c=6; ..

Answer / poornima

Initially, switch statement is ended with semicolon.so
cases will not be alone without switch.It is compilation
error.
If semicolon is not there in switch statement answer is
zero.

Is This Answer Correct ?    6 Yes 0 No

f1() { f(3);} f(int t) { switch(t); { case 2: c=3; case 3: c=4; case 4: c=5; case 5: c=6; ..

Answer / shruti

Yeah value of c becomes 0 at the end of the program..

Is This Answer Correct ?    3 Yes 1 No

f1() { f(3);} f(int t) { switch(t); { case 2: c=3; case 3: c=4; case 4: c=5; case 5: c=6; ..

Answer / vignesh1988i

c=6.... since no break statement

Is This Answer Correct ?    1 Yes 3 No

Post New Answer

More C Interview Questions

what is the difference between structural,object based,object orientd programming languages?

1 Answers   PanTerra,


What are the two types of structure?

0 Answers  


How can I send mail from within a c program?

0 Answers  


What is a memory leak? How to avoid it?

1 Answers  


Without using main fn and semicolon,print remainder for a given number in C language

2 Answers  






What is the ANSI C Standard?

0 Answers   Celstream,


write an interactive program to generate the divisors of a given integer.

7 Answers   TCS,


c language supports bitwise operations, why a) 'c' language is system oriented b) 'c' language is problem oriented c) 'c' language is middle level language d) all the above

0 Answers  


Explain how do you print an address?

0 Answers  


What are # preprocessor operator in c?

0 Answers  


What is an object?

5 Answers  


CAN WE DEFINE ANY FUNCTION WITHIN A FUNCTION.

15 Answers  


Categories