TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: PASCAL SCHMIDT
from: CHARLES ANGELICH
date: 2004-04-14 17:03:00
subject: Squares

123a05c48cd1
c_echo



Hello Pascal - 

--8<--cut 

JB>>> for (n=0; target[n] != '\0' ; n++) { 

DM>> I prefer this one. ;-) 

PS> I would write this one as (minor difference only): 

PS> for (n = 0; target[n] != 0; n++) { ... } 

JB>>> and possibly even better re-written to use a char*
JB>>> instead for( s=target ; *s ; s++ ) { 

DM>> Yes, I like this even more ;-) 

PS> I think that's obfuscated enough to require several seconds
PS> of thought when looking at it some time after writing it. ;) 

PS> However, I never needed to traverse a string this way in
PS> all the C programs I have written so far. 

I know that I _have_ used the above method (str pointer). It
_does_ seem to be more K&R than how C is thought of today but I
liked it at the time. :-) 

>
>        ,                          ,
>      o/      Charles.Angelich      \o       ,
>       __o/
>     / >          USA, MI           < \   __\__
 

--- * ATP/16bit 2.31 * 
... DOS the Ghost in the Machine! http://www.undercoverdesign.com/dosghost/
* Origin: Try Our Web Based QWK: DOCSPLACE.ORG (1:123/140)
SEEN-BY: 633/267 270
@PATH: 123/140 500 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.