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
How can a program be made to print the line number where an error occurs?
an expression contains relational operators, assignment operators, and arithmatic operstors. In the absence of parentheses, they will be evaluated in which of the following order a) assignment, relational, arithematic b) arithematic, relational, assignment c) relational, arithematic, assignment d) assignment, arithematic, relational
What is getch() function?
How many types of errors are there in c language? Explain
What do you mean by dynamic memory allocation in c?
What is gets() function?
What is the difference between text files and binary files?
Difference between MAC vs. IP Addressing
What is oops c?
What is adt in c programming?
What is wrong with this initialization?
What is c++ used for today?
What are local static variables? How can you use them?
Explain what math functions are available for integers? For floating point?
What is the general form of #line preprocessor?