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

Write a program to print numbers from 1 to 100 without using loop in c?

0 Answers  


which is faster execution: loops or recursion?

3 Answers  


c program to subtract between two numbers without using '-' sign and subtract function.

1 Answers  


What is a keyword?

0 Answers  


write a program to input 10 strings and compare without using strcmp() function. If the character of one string matches with the characters of another string , sort them and make it a single string ??? example:- str1="Aakash" st2="Himanshu" str="Uday" output:- Aakashimanshuday (please post the answer as quickly as possible)

0 Answers   Google,






Define a structure to store the record of library. The record must consist of at least following fields: Title, Author, Edition, Price, Publisher, and Category. -Define functions authorSearch ( ), TitleSearch ( ) and CategorySearch ( ) to search a book with respect to author, title and category. [There can be more than one book, written by one author, in one category]

2 Answers  


While(1) { } when this loop get terminate is it a infinite loop?

5 Answers  


pointer_variable=(typecasting datatype*)malloc(sizeof(datatype)); This is the syntax for malloc?Please explain this,how it work with an example?

2 Answers   eClerx, Excel, kenexa,


#define swap1(a,b) a=a+b;b=a-b;a=a-b; main() { int x=5,y=10; swap1(x,y); printf("%d %d\n",x,y); swap2(x,y); printf("%d %d\n",x,y); } int swap2(int a,int b) { int temp; temp=a; b=a; a=temp; return; } what are the outputs?

4 Answers   Ramco,


What is far pointer in c?

0 Answers  


There are N egg baskets and the number of eggs in each basket is a known quantity. Two players take turns to remove these eggs from the baskets. On each turn, a player must remove at least one egg, and may remove any number of eggs provided they all belong to the same basket. The player picking the last egg(s) wins the game. If you are allowed to decide who is going to start first, what mathematical function would you use to decide so that you end up on the winning side?

1 Answers   Hathway,


What is getch?

0 Answers  


Categories