Are you sure you are compiling the same code that you posted here?
If your compiler complains about this line
p_data = &p_struct->DATA;
with the message "struct / union expected", your compiler is probably broken.
Note that &p_struct->DATA is a perfectly valid expression in C. There are absolutely no problems with this expression in itself.
The problem here is that this is not what you need in your case. &p_struct->DATA returns a pointer to the entire array of "DATA", i.e. pointer of type unsigned char (*)[20] . You are trying to assign this value to an unsigned char * pointer. This is illegal in C because the types are completely different, but traditionally C compilers answered it with a simple warning about type mismatch and performed an implicit conversion (which, BTW, means that your source code, although dirty, should still work on destination).
Even if some compiler decides to flag this mismatch as an error (this is normal), it still should not complain about any problems of the "expected type of structure / union". There are no such problems.
PS As already mentioned, you really need p_data = &p_struct->DATA[0] , but this still does not explain the strange behavior of your compiler. Could it be that "DATA" is a macro defined somewhere before the definition of "clean_buffers"?
Added 10/19/2009: Nate, in your code you will access your array using theCount index. Since you are still using index access, there is no reason to even create the index that you are trying to create. The code will work fine without any additional pointer, just touch the DATA field
theCount = 0; while (p_struct->DATA[theCount] != 0) { p_struct->DATA[theCount++] = 0;
(I would probably use a for loop here).
If you really insist on creating this pointer and still use index access, the code should look something like this (others have already suggested this several times)
p_data = p_struct->DATA; ... theCount = 0; while (p_data[theCount] != 0) { p_data[theCount++] = 0;
In addition, you can choose a more "exotic" option :)
unsigned char (*p_data)[20]; ... p_data = &p_struct->DATA; ... theCount = 0; while ((*p_data)[theCount] != 0) { (*p_data)[theCount++] = 0;
However, returning to the unsigned char *p_data , since you are creating this pointer, it might be wiser to use the "moving pointer" technique instead of using index access
unsigned char *p_data; ... p_data = p_struct->DATA; ... while (*p_data != 0) { *p_data++ = 0;
As always, it all depends on personal preferences. Of course, none of this will work until you get rid of this macro noise.