Scoping question in C
Kevin Cozens
kcozens-qazKcTl6WRFWk0Htik3J/w at public.gmane.org
Tue Jun 14 00:43:43 UTC 2005
billt-lxSQFCZeNF4 at public.gmane.org wrote:
>x=0;
>while ( string[x] != 0 ) { x++; }
>
>
Rather than use a loop you might as well just call strlen(). If you are
going to use a loop here you should add a counter in order to impose a
limit on the number of bytes should be copied based on what you think is
a reasonable upper limit on what your program should expect to handle in
terms of string length.
--
Cheers!
Kevin. (http://www.interlog.com/~kcozens/)
Owner of Elecraft K2 #2172 |"What are we going to do today, Borg?"
E-mail:kcozens at interlog dot com|"Same thing we always do, Pinkutus:
Packet:ve3syb at ve3yra.#con.on.ca.na| Try to assimilate the world!"
#include <disclaimer/favourite> | -Pinkutus & the Borg
--
The Toronto Linux Users Group. Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
More information about the Legacy
mailing list