Thread: for and isspace

  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
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    until current character is whitespace - do something
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

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

Popular pages Recent additions subscribe to a feed