Path: utzoo!attcan!uunet!samsung!usc!jarthur!nntp-server.caltech.edu!seismo.gps.caltech.edu!bruce From: bruce@seismo.gps.caltech.edu (Bruce Worden) Newsgroups: comp.lang.c Subject: Re: initialization Keywords: comma operator Message-ID: <1990Aug3.171956.14504@laguna.ccsf.caltech.edu> Date: 3 Aug 90 17:19:56 GMT References: <1990Aug1.011654.22068@ccu.umanitoba.ca> <11221@odin.corp.sgi.com> Sender: bruce@seismo.gps.caltech.edu (Bruce Worden) Distribution: comp.lang.c Organization: Seismo Lab, California Institute of Technology, CA Lines: 24 In article <11221@odin.corp.sgi.com> jindak@surfside.sgi.com (Chris Schoeneman) writes: >In article <1990Aug1.011654.22068@ccu.umanitoba.ca> rpjday@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@seismo.gps.caltech.edu", "No NeWS is good NeWS");