you know the Stroustrup says:"..you cannot initialize an array with a non constant expression" or something like this.
Well, i'm on a mac and i use XCode to compile my c++ projects.
Can you explain me why the hell i'm able to compile without ANY errors and with the correct output, the following code??
- Code: Select all
#include <iostream>
int main()
{
int size;
std::cin >> size;
int array[size];
array[0] = size;//just to test
std::cout << array[0];
}
Thanks
