int main() {
std::cout << 1, std::cout << 2;
return 0;
}
The above snippet is syntactically correct, as commas can be used to separate statements. However,
int main() {
int a, std::string b;
return 0;
}
This returns with an error
Expected initializer before 'b'
Why is this? Is there some circumstances I cannot use a comma to separate statements? For example in this case definition of variables?