06-11-2010 05:15 AM
I'm having trouble allocating a dynamic matrix array, in Labwindows. The version I'm using is 9.1 and have turned on build with c99, but still I can't declare variable matrices as "array[n][m]"; the error message is " Types based on variable length arrays are illegal at file scope."
As an alternative I've also tried
double *matrix_transposed=NULL;
matrix_transposed=calloc (n, sizeof (double));
but still without success, because I get this : " Redeclaration of 'matrix_transposed' previously declared at proiect...."
How can I go about this, or am I doing something extremely wrong?
06-11-2010 05:23 AM
06-12-2010 12:47 PM
The error is just what it says: variable length arrays in C99 must be of block scope. They are allocated off the stack, rather than the heap, and the restriction makes perfect sense if you think about it. They can't be extern or static storage class either.
Menchar