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;
}
Answer Posted / 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 |
Post New Answer View All Answers
What are the 5 types of inheritance in c ++?
What is the meaning of ?
What is the purpose of & in scanf?
Function calling procedures? and their differences? Why should one go for Call by Reference?
Write a program to find the biggest number of three numbers in c?
List a few unconditional control statement in c.
Explain what is the difference between the expression '++a' and 'a++'?
Can we use any name in place of argv and argc as command line arguments?
What is the difference between exit() and _exit() function?
How can I swap two values without using a temporary?
What is null character in c?
What is union in c?
Why c is called free form language?
How do shell structures work?
Why ca not I do something like this?