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 |
Explain the difference between structs and unions in c?
What is true about the following C Functions a.Need not return any value b.Should always return an integer c.Should always return a float d.Should always return more than one value.
int main() { Int n=20,i; For(i=0;i<=n;i--) { Printf(“-“); Return 0;
How can I write functions that take a variable number of arguments?
in linking some of os executables are linking name some of them
What is the best style for code layout in c?
What is the difference between memcpy and memmove?
How do shell structures work?
What is a keyword?
all c language question
How does sizeof know array size?
WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ?