Well, I came across this, and I don't know what to think, I know that to allocate memory the operator is necessary new
, however I don't understand why this code works?, and in any case, what are the possible failures? (maybe it's a new c++11 feature that I'm not aware of?)
cout << "introduzca la capacidad ";
cin >> capacidad;
// como es esto posible?
double array[capacidad];
for (int i = 0; i < capacidad; i++){
cout << "Numero " << i+1 << ": ";
cin >> array[i];
}
for (int i = 0; i < capacidad; i++)
cout << "Numero " << i+1 << ": " << array[i] << "\n";
Thank you