Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!asuvax!stjhmc!f14.n15.z1.fidonet.org!Dave.Harris From: Dave.Harris@f14.n15.z1.fidonet.org (Dave Harris) Newsgroups: comp.lang.c Subject: Increment Counters in declaration or in loop? (style question) Message-ID: <14208.285B768C@stjhmc.fidonet.org> Date: 16 Jun 91 14:18:45 GMT Sender: ufgate@stjhmc.fidonet.org (newsout1.26) Organization: FidoNet node 1:15/14 - Nibbles 'n Bits, Orem UT Lines: 30 >From: dm@phsbbs.princeton.nj.us (Doron Meyer) >Date: 11 Jun 91 12:09:44 GMT >Organization: Princeton High School, Princeton, New Jersey >Message-ID: >Newsgroups: comp.lang.c >Hello net land. What is the 'preferred' stylistic method of incrementing >counters? For example, this simple for loop. >for (count=0; count<4; count++) >{ > printf("name[%d]: %c\n", count, ptr++); you could go: for (count=0 ; count < 4; count++, ptr++) printf("name[%d]: %c\n", count, ptr); I have seen both done but actually tend to use it the way you do. Dave Harris. -- Uucp: ...{gatech,ames,rutgers}!ncar!asuvax!stjhmc!15!14!Dave.Harris Internet: Dave.Harris@f14.n15.z1.fidonet.org