little quiz

tgg at hou5e.UUCP tgg at hou5e.UUCP
Fri Mar 23 01:29:50 AEST 1984


>While we are discussing C, how many people believe that
>        for (initial; test; update) statement;
>is ALWAYS equivalent to
>        initial;
>        while (test) {
>                statement;
>                update;
>                }
>how many people can cite the exception to the above rule?  (ie, one
>clearcut case where they produce different results).

Easy - what about:
	for ( a= 0; a < 100; a++ )
		if ( a % 10 == 0 )
			printf("where a is a multiple of ten is %d\n",a);
		else
			continue;	/* bad example but it works */

Tom Gulvin	AT&T Information Systems - Holmdel



More information about the Comp.lang.c mailing list