LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

const and multi dem array compile problem

Why do I get the following compiler error:

**Illegal type 'const const int'**


when I try to compile this?


int somefunction(int someparameter)
{
const int myarray[][2] = /* Why won't it let me use const? */
{
{5, 37},
{6, 36},
}; /*the rest of the somefunction definition here*/
}

I'm using labwindows ver6
0 Kudos
Message 1 of 2
(2,511 Views)
Kevin,

You can avoid this compiler error by declaring the const array as a static:

static const int myarray[][2] = {{5, 37}, {6, 36},};

I'm not sure why you would get an error when declaring a 2D array and not 1D array. I believe it has to do with the memory allocation. When you declare it as static the space is kept between function calls which may be needed for 2D arrays.

I'll do some further research, I'll post here any info that I can find.

Regards,

Juan Carlos,

N.I.
0 Kudos
Message 2 of 2
(2,511 Views)