WAY OT NOW Re: 'goto" gone from computer languages or is it!

Vintage Computer Festival vcf at siconic.com
Mon May 16 17:00:28 CDT 2005


On Mon, 16 May 2005, Jim Battle wrote:

> I'd do this, and didn't even know that jumping into the middle of the
> FOR loop was legal.  Even knowing it is legal, I prefer my way (of course):
>
> void print_ary (int *aryp, int n)
> {
>     int i;
>     for (i=0; i<n; aryp++, i++)
>        {
>            if (i>0)
>                printf (", ");
>            printf ("%u", *aryp);
>        }
>     printf ("\n");
> }

Um, if you're anal like me, you don't want to print a comma after the last
value, so:

...
       printf ("%u", *aryp);
       if (i<n) printf (", ");
...

Anyway, jumping into the middle of a loop as John prefers is, in my
opinion, horrible form ;)

-- 

Sellam Ismail                                        Vintage Computer Festival
------------------------------------------------------------------------------
International Man of Intrigue and Danger                http://www.vintage.org

[ Old computing resources for business || Buy/Sell/Trade Vintage Computers   ]
[ and academia at www.VintageTech.com  || at http://marketplace.vintage.org  ]




More information about the cctalk mailing list