I'm trying to understand why we have to use new operator in C++. I have wrote short program:
int N;
std::cin >> N;
int tab[N];
for (int i = 0; i < N; i++)
tab[i] = i + 1;
for (int i = 0; i < N; i++)
std::cout << "tab[" << i << "] = " << tab[i] << std::endl;
This program works correctly. The same behavior I have noticed in C using this algorithm (instead of malloc() function).