'goto" gone from computer languages or is it!

John Hogerhuis jhoger at gmail.com
Mon May 16 16:33:45 CDT 2005


On 5/16/05, Dave Dunfield <dave04a at dunfield.com> wrote:
> Given that the original example assumes n > 0 (the test is skipped on
> first entry to the loop), you can accomplish this function with neither
> an extra conditional, superfluous assignment, extra variables or use
> of 'goto'
> 
> void print_arg(int *aryp, unsigned n)
> {
>    int i;
>    for(i=0; ;) {
>       printf("%u", aryp[i]);
>       if(++i >= n)
>          break;
>       fputs(", ", stdout); }
>    putc('\n', stdout);
> }

Now that's a right answer.

-- John.



More information about the cctalk mailing list