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
write a c program to calculate sum of digits till it reduces to a single digit using recursion
How can you read a directory in a C program?
What are the advantages of the functions?
Explain what is page thrashing?
any C program contains only one function, it must be a) void () b) main () c) message () d) abc ()
What is pivot in c?
Is main is user defined function?
What is scanf_s in c?
How many bytes are occupied by near, far and huge pointers (dos)?
What is actual argument?
Which is best book for data structures in c?
Explain with the aid of an example why arrays of structures don’t provide an efficient representation when it comes to adding and deleting records internal to the array.
Why is c so popular?
a single linked list consists of nodes a to z .print the nodes in reverse order from z to a using recursion
What are run-time errors?