View previous topic :: View next topic |
Author |
Message |
jerrybrowse
Joined: 17 Sep 2003 Posts: 2 Location: Herts. UK
|
Problem pointing into a structure |
Posted: Fri May 20, 2005 9:25 am |
|
|
I have a problem accessing data within a structure. The structure is:
Code: | struct maxfio
{
int max_rcv[32];
int *p_rcv;
int rcv_chksm;
} maxfcb[4]; |
max_rcv is a buffer for serial data coming in.
*p_rcv is the pointer to access it.
Assuming dbyte is an int8 and block is an int8, and the pointer is correctly
set, I use the following that works:
Code: | dbyte=*(maxfcb[0].p_rcv)++; // hard maxfcb index reference |
However, if I use a variable, 'block', whose value is 0 thus:
Code: | dbyte=*(maxfcb[block].p_rcv)++; // varible maxfcb index reference |
this does not work.
Is this incorrect syntax or is the compiler confused? |
|
|
mike holeton Guest
|
|
Posted: Fri May 20, 2005 9:36 am |
|
|
Have you defined block any where? int, char, etc. I think the compiler is confussed, because it does not know what block is. |
|
|
jerrybrowse
Joined: 17 Sep 2003 Posts: 2 Location: Herts. UK
|
|
Posted: Fri May 20, 2005 9:41 am |
|
|
Thanks for the reply Mike.
No, I'm afraid block is defined (as an int8) and is set to a value which in this case is zero (hex).
Regards
Jerry |
|
|
|