Finding a space in an array

This is a discussion on Finding a space in an array within the C++ Programming forums, part of the General Programming Boards category; Hi everyone, I'm trying to create a loop that finds a space in an array starting from the position 79. ...

as for your code, heres what i think...
-no need for counter variable, you initialized 'i' outside the for loop anyway so that itself is the position of the space
-the cast is not needed, just check if its a space ' '
-in my opinion this is better suited for a while loop, but it doesnt matter really

your version doesnt work just because you have your for loop condition set to "continue while the character is a space'. instead of 'loop while it IS NOT A SPACE'