Original_Batman's blog

By Original_Batman, history, 8 years ago, In English
#include<bits/stdc++.h>

using namespace std;

int main()
{
   int n;
   cin >> n;
   int arr[n];           //Variable length array
   return 0;
}

Hey there, I've seen many people use variable length array in their programs but the problem is I program on Visual Studio and it doesn't allow me to use #include<bits/stdc++.h>. So I wanted to know which particular header file allows us to have variable length arrays.

  • Vote: I like it
  • -3
  • Vote: I do not like it

| Write comment?
»
8 years ago, hide # |
 
Vote: I like it +13 Vote: I do not like it

It is not header files which allow you to do so, it actually depends on the compiler. Almost all Online Judges use GNU that supports variable length arrays.