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 is an lvalue?
Write a program to print "hello world" without using a semicolon?
How many types of errors are there in c language? Explain
What is the general form of function in c?
Why is c called a structured programming language?
Explain how does free() know explain how much memory to release?
When should I declare a function?
What language is windows 1.0 written?
What are variables and it what way is it different from constants?
Can we initialize extern variable in c?
Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result
How are variables declared in c?
What is c language in simple words?
Explain the term printf() and scanf() used in c language?
What is the difference between c and python?