I knew there have been several questions about variable length array (VLA). I thought the general conclusion is that VLA is not supported. But the following code will compile just fine. Anyone can explain it?
#include <iostream>
#include <vector>
using namespace std;
void func(vector<int> v){
int arr[v.size()] = {0};
int b = 4;
return;
}
void func2(int n)
{
int arr[n];
}
int main()
{
vector<int> v = {1,2,3};
func(v);
func2(10);
int len = 8;
int arr[len] = {0};
return 0;
}