I'm creating static array of chars which size is defined runtime. And I'm not getting compilation errors.
How is this possible?
Here is my example:
void f(const string& val) {
char valBuf[val.size() + 1]; strcpy(valBuf, val.c_str());
cout << valBuf << endl;
}
int main() {
string str = "aaaa";
f(str);
return 0;
}