I have had problems with passing a pointer to an array in Labwindows/CVI for some time. Methods and declarations that compile fine in other C compilers do not seem to work in Labwindows/CVI 6.0. A recent example along with the compiler error follows:
Any thoughts?
//a few declares//
struct _myStruct {
unsigned char SBUF[8]; /* structure buffer*/
unsigned int num1;
unsigned int num2;
unsigned char *aux;
struct _myStruct *next;
};
uchar globalBuffer[8]; /*some global array*/.
struct _myStruct *myStruct_ptr, /* mystruct pointer */
*myStruct_end; /* end of the list */
//function prototype with pointer to array
void myFunction(uchar *buffer);
//function itself
void myFunction(uchar *buffer)
{
uchar i;
{
for (i = 0; i < 8; i++)
buffer[i] = globalBuffer[i];
}
}
//calling the function
myFunction( &myStruct_end->SBUF);
And the compiler error:
Type error in argument 1 to 'myFunction'; found 'pointer to array 8 of
unsigned char' expected 'pointer to uchar'.