I got this rather simple code here, which puts out a string, but before it's converted to single char characters.
And here's my problem, what does this ":" operator in the for loop mean / what is it exactly doing.
I only found information on heritage with this operator and the usage for simplified if branches.
#include <iostream>
#include <string>
using namespace std;
void stringdemo()
{
string s1;
s1.assign("Hello World!");
for (char c : s1)
{
cout << c;
}
}
int main()
{
stringdemo();
return 0;
}
If someone of you knows how this operator is working, it would be glad, if you could answer me my question :) (a link to a any site, which explains this is also ok :D)