Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help with C Programming assignment
#8
Watch your brackets, make sure they go around what you want them to. And the indentation's a bit messy; fixing that up should help with the brackets too.

Break statements only break the innermost loop.

"and is string1[i] really a boolean expression to denote when its not null? or do i have to say like string[i] != '\0' ?"
I'm pretty sure that a loop condition (and if for that matter) is treated as false if it is 0, and true otherwise. So if the character is '\0', it'll be treated as false, otherwise it's true.

But yes; the "clearer" way to do it is string[i] != '\0'.
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 Russt - 2009-11-24, 11:03 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

Forum Jump:


Users browsing this thread: 1 Guest(s)