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
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 |
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 |
what is the difference between procedure oriented and object oriented progaming language
wat is the output #define VOLEDEMORT _who_must_not_be_named int main() { printf("VOLEDEMORT"); }
explain what is an endless loop?
Can include files be nested?
What is sizeof return in c?
Write a program to interchange two variables without using the third variable?
17 Answers Accenture, College School Exams Tests, Infotech,
What is extern variable in c with example?
enum { SUNDAY, MONDAY, TUESDAY, }day; main() { day =20; printf("%d",); getch(); } what will be the output of the above program
Can anyone tell what is stack overflow? what precaution we should take?
What is a class?
What is the difference between c and python?
Write a function in c to find the area of a triangle whose length of three sides is given.