This is a piece of code from a book that wont compile. It report's index was not declared in this scope, And it look's like index will alway's be 0(zero).
I added the s = some string line to give something to work with.
1 2 3 4 5 6 7 8 9
std::string s = ("some string");
for (decltype(s.size()) index = 0; index != s.size() && !isspace(s[index]); ++index); s[index] = toupper (s[index]);