2009-11-24, 11:03 PM
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'.
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'.

