I am trying to use a volatile unsigned char as a pointer array argument to a function. I created the function:
static void queue_to_serial(unsigned char *queue)
I'm using "static" for the function, because it is only to be used in the current source file. Then I call the function and supply the address:
queue_to_serial(&queue);
And I get an error:
Error[Pe167]: argument of type "unsigned char volatile (*)[8]" is incompatible with parameter of
type "unsigned char *"
The array is declared as a volatile but from what I know that means it shall not be optimized out as it can change asynchronously
static volatile unsigned char queue[MAX_NUM_CONNECTED_VALVES];
The array is also declared to be static because I would like to retain the value assigned to the variable. Unless the array is updating at the exact time the function is run which should not happen this should in my mind work because the memory used by a volatile unsigned char is the same as an unsigned char. How does making a variable volatile change it? Or does declaring it as a pointer cause it to occupy memory at a different location? Thank you
queue_to_serial(queue);queueis already a pointer. The volatile flag is unrelated to that error. - yhyrcanus*aanda[]are "equivalent" (not really but it depends on context), but you're passing&queuewhenqueueis already an array ofchar. The error message shows this. Since you get a similar error message when you passqueue, you should update your question with that code and error message, which is closer to correct. - trentcl