When i run this code in my Devcpp compiler->
#include<bits/stdc++.h>
using namespace std;
int main()
{
vector<int> vec;
for(int i=0;i<100000000;i++)
vec.push_back(i);
}
It works even on run time. But when i run->
#include<bits/stdc++.h>
using namespace std;
int arr[1000000000];
int main()
{
return 0;
}
It gives me link error.
As long as space is required both arr and vec requires the same space.Then why is it that vec code runs even fine on run time but arr code doesnt even compile.