Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!wuarchive!udel!princeton!phsbbs!dm From: dm@phsbbs.princeton.nj.us (Doron Meyer) Newsgroups: comp.lang.c Subject: Increment Counters in declaration or in loop? (style question) Message-ID: Date: 11 Jun 91 12:09:44 GMT Organization: Princeton High School, Princeton, New Jersey Lines: 18 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++); In this instance, the loop counter is incremented in the declaration of the for loop, and the ptr variable, which still gets incremented each time the loop cycles, is incremented within the body of the loop. Is this more of a matter of personal opinion than anything else? If so, what are your opinions? ----- Doron Meyer, System Administrator Emeritus, Princeton High School DNS: dm@phsbbs.princeton.nj.us UUCP: ...!princeton!phsbbs!dm PSTN: 609-921-2978 USnail: 64 Farrand Road / Princeton, NJ 08540