Número de caracteres em string
std::string hello = "Hello";
int len = 1;
for(const char charac : hello)// Here the for loop take each character
// one by one and initialize it to charac.
// What happened in the for loop is
// for loop took the first character in hello
// and initialized it to charac(This was in the first loop)
// and so on until it processes all the characters
{
++len;
}// Note : in any string variable there is always a space at the last(as below)
std::cout << "Number of characters is " << numofchars - 1;
Stormy Skimmer