I was wondering what are some alternatives to doing the following code snippet in c++.
int i;
cin >> i;
int arr[i];
I have recently started looking into competitive programming and trying to learn more.
EDIT: For those comments about this not being cpp. It compiles successfully with the makefile I am using in my class which is using gcc -std=c++11 -o a.exe main.cpp
and returns to the console when I input a length of 1
array length: 1