switch.and.case

Meeks dwm at pur-ee.UUCP
Fri Jun 1 02:18:44 AEST 1984


Let us get some serious discussion on this little piece of code:

main()
{
	int a,b;
	switch(a=6){
		b = a;
		if (b) {
			case '3' :
				printf("case three\n");
				break;
			case '6' :
				printf("case six\n");
				break;
			default:
				printf("error ... \n");
		}
		else {
			case '3' :
				printf("case three no b\n");
				break;
			case '6' :
				printf("case six no b\n");
				break;
			default:
				printf("not again ... \n");
				break;
		}
	}
}

okay folks, what really happens?

Tanks, Dan Meeks ... pur-ee!dwm



More information about the Comp.lang.c mailing list