A question of style
Wade Guthrie
evil at arcturus.UUCP
Tue Dec 12 04:44:28 AEST 1989
In article <565 at s5.Morgan.COM> amull at Morgan.COM (Andrew P. Mullhaupt) writes:
>I would like to elaborate: There are no good excuses for the comma
>operator . . .
and gwyn at smoke.BRL.MIL (Doug Gwyn) responds:
>. . .It has uses primarily in macros, occasionally in conditionals.
I always thought that an interesting use for the comma was in a for
loop when one wanted, say, to create the identity matrix:
float array[SIZE][SIZE];
int i,j;
/* initialize the whole thing to zero, then to this: */
for(i=0,j=0; i<SIZE; i++, j++)
array[i][j] = 0;
Although, I guess, you don't need two indices for this.
Wade Guthrie
evil at arcturus.UUCP
Rockwell International
Anaheim, CA
(Rockwell doesn't necessarily believe / stand by what I'm saying; how could
they when *I* don't even know what I'm talking about???)
More information about the Comp.lang.c
mailing list