I suggested a while loop in a later post--I wasn't thinking that the length 
would get executed every time the loop did. it makes sense, just didn't occur 
to me at the time.


Thanks,
Tyler Littlefield
email: [EMAIL PROTECTED]
web: tysdomain-com
Visit for quality software and web design.
skype: st8amnd2005

  ----- Original Message ----- 
  From: David Hamill 
  To: [email protected] 
  Sent: Saturday, November 08, 2008 8:10 AM
  Subject: Re: [c-prog] Re: Command line parameters


  > Every iteration of the loop causes you to run
  > another loop just to determine the string's length. Since 
  > you aren't
  > changing the length within the loop, the extra loop is 
  > pointless.

  The strlen() should certainly be outside the loop. But you 
  don't actually need to know the length of the string; you 
  just need to step through it until you reach its zero 
  terminator. This is easy if you use a 'while' loop instead 
  of a 'for' loop.

  Maybe this is a bit low-level, but it's fast and a typical C 
  idiom. See K&R for numerous examples.

  David



   

[Non-text portions of this message have been removed]

Reply via email to