A perverse switch statement.

Felix Lee flee at shire.cs.psu.edu
Sat Oct 14 00:55:10 AEST 1989


Something sparked by comp.std.c's "declarations in switches"
discussion.  Duff's device and Obfuscated C: all perverse.

main()
{
	int i, j = 1;
	for (i = 0; i <= 6; ++i)
		switch (i)
		top:
		case 6:	{
			int k = 3;
		case 0:	for (; ++k % 3; ++j) {
		case 1:		printf(" j = %d,", j);
		case 2:		printf(" k = %d\n", k);
			}
		case 3: printf("i = %d\n", i); break;
		case 4: printf("i = %d\n", i);
		case 5:	goto top;
		}
}
--
Felix Lee	flee at shire.cs.psu.edu	*!psuvax1!flee



More information about the Comp.lang.c mailing list