Multiple case selection

M

madarajubalu

#include"stdio.h"
main()
{
int i;
switch(?)
{
case 1:
printf("AB");
break;
case 2:
printf("CD");
break;
default:
printf("CDAB");
break;
}
}

Question:
What expression should replace the '?' in the above program to print the result ABCD?
 
S

Stefan Ram

What expression should replace the '?' in the above program
to print the result ABCD?

»main« should be declared to return »int«.

putchar( 'A' ), putchar( 'B' ), 2
 
K

Keith Thompson

»main« should be declared to return »int«.

And it should be defined with no parameters, not with unspecified
parameters:
int main(void)

And
#include"stdio.h"
should be
#include <stdio.h>
 
K

Kenny McCormack

And it should be defined with no parameters, not with unspecified
parameters:
int main(void)

And
#include"stdio.h"
should be
#include <stdio.h>

Thread drift anyone???

Or, "I'll take 'Totally Missing The Point' for $800, Alex!"

Typical of Kiki...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top