LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic array

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?

0 Kudos
Message 1 of 3
(3,325 Views)
I forgot to mention that what I'm trying to  do is to take a variable matrix, transpose it, and then compare it to the original. This is done by clicking a button on the UI.
0 Kudos
Message 2 of 3
(3,324 Views)

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

0 Kudos
Message 3 of 3
(3,286 Views)