M
merk
I always understood that an array had to have a defined size at compile
time via either a real value or a const so why does this work? Note
that it does fail in MS Visual Studio 2003.
#include <iostream>
int main()
{
int n;
std::cin >> n;
double a[n][n];
a[0][0] = 1.0;
a[0][1] = 2.0;
std::cout << a[0][0] << " " << a[0][1] << std::endl;
}
Thanks,
merk
time via either a real value or a const so why does this work? Note
that it does fail in MS Visual Studio 2003.
#include <iostream>
int main()
{
int n;
std::cin >> n;
double a[n][n];
a[0][0] = 1.0;
a[0][1] = 2.0;
std::cout << a[0][0] << " " << a[0][1] << std::endl;
}
Thanks,
merk