for and isspace

This is a discussion on for and isspace within the C Programming forums, part of the General Programming Boards category; Hello! I have a question about for loops and isspace. for (i = 0; isspace(s[i]); i++) In this for loop ...

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    5

    for and isspace

    Hello! I have a question about for loops and isspace.

    for (i = 0; isspace(s[i]); i++)

    In this for loop I don't understand how it knows when to stop based on the isspace(s[i]). I thought the second condition had to be something like "until such and such happens the loop continues" but I don't see that happening here.
    Thanks!

  2. #2
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,424
    until current character is whitespace - do something
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  3. #3
    Registered User
    Join Date
    Mar 2009
    Posts
    5
    ohhh ok, thank you!

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21