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 use of linkage in c language?
Who is the main contributor in designing the c language after dennis ritchie?
Explain c preprocessor?
WHAT IS LOW LEVEL LANGUAGE?
how to find string length wihtout using c function?
ASCII stands for
How can you increase the size of a statically allocated array?
A routine usually part of the operation system that loads a program into memory prior to execution a) linker b) loader c) preprocessor d) compiler
provide an example of the Group by clause, when would you use this clause
Can the curly brackets { } be used to enclose a single line of code?
What does the message "warning: macro replacement within a string literal" mean?
i want to asked a question about c program the question is: create a c program that displays all prime numbers less than 500? using looping statement