initialization
Bruce Worden
bruce at seismo.gps.caltech.edu
Sat Aug 4 03:19:56 AEST 1990
In article <11221 at odin.corp.sgi.com> jindak at surfside.sgi.com (Chris Schoeneman) writes:
>In article <1990Aug1.011654.22068 at ccu.umanitoba.ca> rpjday at ccu.umanitoba.ca
>writes:
>>int func(int a)
>>{
>> int i = a, j = i + 1 ;
>>
>>Am I allowed to initialize the integer "j" with the value of
>>another variable initialized in the same line?
>Of course you're allowed. C doesn't care if "i" is initialized or not!
>But don't worry, the comma operator is evaluated left to right. So your
>code will always work correctly (i.e. "a" will be assigned to "i", then
>"i"+1 will be assigned to "j").
I am under the impression that the commas that separate variables in
declarations, like those that separate function arguments, are not comma
operators. I am under that impression because it explicitly states that
in K&R. Is this statement a mis-statement in the book, or am I
misunderstanding the statement? Does the presence of an assignment
in a declaration change the comma into a comma operator?
sig("Bruce Worden", "bruce at seismo.gps.caltech.edu", "No NeWS is good NeWS");
More information about the Comp.lang.c
mailing list