help2 in c++
Hi,
int N=100;
double H[N];
this will not work, however
const int N=100;
double H[N];
this will work and the difference between
1)
#define N 100
double H[N];
and
2)
const int N=100;
double H[N];
in case 1, the compiler simply replace the N with the number defined and compiles the code, this is done during the precompilation phase of the compiler
in case 2, the compiler compiles the code as it is and i would recommend this because the code is more type safe this way.