Which is more memory efficient and why between declaring the size of an array at run time using the 'new' keyword for dynamic memory allocation and using the method below:
#include <iostream>
using namespace std;
int main ()
{
int size;
cin >> size;
int a[size];
}
Dynamic Memory allocation using 'new' key word
#include <iostream>
using namespace std;
int main ()
{
int *array {nullptr};
int size;
cin >> size;
array = new int[size];
delete [] array;
}