Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help with C Programming assignment
#27
JoeTang Wrote:I highly suggest you review learn how to do loops. Breaking conditions are there for a reason; that reason is not to stick a random letter there.
Strings are null-terminated, so the end of the string breaks the loop.

It's a lazy way to do things, but it works so why not.
True, the nicer way to do it would be
Code:
for (i = 0; i < strlen(longstr); i++)
but it accomplishes the same thing as
Code:
for (i = 0; longstr[i][color=gray] != '\0'[/color]; i++)
anyway.
Reply


Messages In This Thread
Need help with C Programming assignment - by Fiel - 2009-11-23, 09:18 PM
Need help with C Programming assignment - by Fiel - 2009-11-23, 09:22 PM
Need help with C Programming assignment - by Fiel - 2009-11-25, 08:13 AM
Need help with C Programming assignment - by Fiel - 2009-11-25, 11:51 AM
Need help with C Programming assignment - by Russt - 2009-11-26, 07:41 PM

Forum Jump:


Users browsing this thread: