Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


int main()
{
int i=1;
switch(i)
{
case '1':
printf("hello");
break;
case 1:
printf("Hi");
break;
case 49:
printf("Good Morning");
break;
}
return 0;
}

Answers were Sorted based on User's Feedback



int main() { int i=1; switch(i) { case '1': printf("hello"); break; case..

Answer / srsabariselvan

The program Results in Error.
it will shows error "Duplicate case".
because '1' is equal to 49(ASCII of character 1).

Is This Answer Correct ?    8 Yes 0 No

int main() { int i=1; switch(i) { case '1': printf("hello"); break; case..

Answer / vishnu nayak

it will display Hi. In case '1', 1 is a character and it is
converted into ascii equivalent and then tested, which is
not equal to 1.

if the code is like this
swithc(i)
{
case 1:
printf("hi");
break;
case 1:
printf("Hello ");
break;

} then it will surly give compilation error.

Is This Answer Correct ?    4 Yes 2 No

int main() { int i=1; switch(i) { case '1': printf("hello"); break; case..

Answer / hussain reddy

error because duplicate case values

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More C Interview Questions

What is the basic structure of c?

0 Answers  


write function to reverse char array ... without using second array

3 Answers  


how can be easily placed in TCS.

0 Answers   TCS,


What are categories used for in c?

0 Answers  


write a program that finds the factorial of a number using recursion?

13 Answers   Infosys, TATA,


Is main is user defined function?

0 Answers  


What is action and transformation in spark?

0 Answers  


Program to trim a given character from a string.

5 Answers   NetApp,


What is the difference between a function and a method in c?

0 Answers  


If null and 0 are equivalent as null pointer constants, which should I use?

0 Answers  


In the below code, how do you modify the value 'a' and print in the function. You'll be allowed to add code only inside the called function. main() { int a=5; function(); // no parameters should be passed } function() { /* add code here to modify the value of and print here */ }

1 Answers  


What is the best style for code layout in c?

0 Answers  


Categories