Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Sun, 16 Dec 2012 09:30:56 -0600 Message-ID: <50CDE932.4B5@mindspring.com> Date: Sun, 16 Dec 2012 10:30:58 -0500 From: pete Reply-To: pfiland@mindspring.com Organization: PF X-Mailer: Mozilla 3.04Gold (WinNT; I) MIME-Version: 1.0 Newsgroups: comp.lang.c Subject: Re: comma in a c statement, ie for(i=0,i2=0;i<10;i++,i2) References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 42 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 4.154.218.66 X-Trace: sv3-St6BmIxrKefP3ryyXcXVRg6X+H8bl68opJSxv8mbKPl8DdIEp99A8PD5DeZhWHxDeLUC1xhb0TmwbgE!ppA4bHg0i+ZiCBAIS3l5K13thlUPiCmArGatUz6+98QbZtHxEqSpa+nD+ZqAL8GKiGIkpLy+29ey!bOfMTDBm X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 1833 Xref: csiph.com comp.lang.c:29333 Test wrote: > > I have: > > for (i=0,i2=0;i<10;i++,i2++) > { > .. some code > } > > Is "," (comma) oke here? Yes. > I am converting below code to for -loop: > > i=0; > i2=0; > while (i<10) > { > ... some code > i++; > i2++; > } > > Which is executed first in for (i=0,i2=0;i<10;i++,i2++)? i2=0 or i=0? i=0 > Any caveats? > I could not find explanation to comma usage (maybe not not looking > hard enough). Not being able to find an explanation without looking hard, might be considered to be a caveat. Also, as I believe others have mentioned, if ".. some code" contains a "continue" statement, then i++ i2++ will be executed at the end of the "for loop" but not at the end of the "while loop". -- pete