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 an ERP?
hi friends how r u as soon in satyam my interview is start but i m very confusued ta wat i do plz help me frndz wat can i do plz tell me some question and answers related with "C" which r asked in the interview .
0 Answers Aegis, CDAC, Infosys,
What is the difference between declaring a variable and defining a variable?
How can I access memory located at a certain address?
Compare interpreters and compilers.
wite a programme in c to linear search a data using flag and without using flags?
What is the difference between far and near in c?
Define function pointers?
Write a pro-gramme to determine whether the number is even or odd?
how to print electricity bill according to following charges first 100 units -1rs per unit for next 200 units-1.50 rs per unit without using conditions
can u suggest me am in a confusion to choose whether to go to c programming or a software testing . am a graduate in B.sc(electronics).
What are the properties of union in c?