Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/19/03 02:50
Read: times


 
#43738 - Pointers to Structure Elements
Hi all

I know that this is sort of more related to the C programming langauge than the 8051, but here is the question.

I am reading data in serially and would like to store the data in a structure, however I would prefer to simply start at the top of the structure and have a pointer to each element in the structure so that I can sit in a simple while loop to load the data into the structure, rather than having to manually load each element of the structure when the data comes in.

The question is:
Is there any way to obtain a pointer to each element of a structure? the elements can be different lengths as shown in the struct declaration below.



struct Action
{
unsigned char Address;
unsigned char Function;
char Day[4];
char Date[11];
char StartTime[5];
char EndTime[5];
unsigned char Action;
unsigned char Devices[MAXDEVICES];
};

Thanks for any assistance

Regards


Marshall Brown

List of 12 messages in thread
TopicAuthorDate
Pointers to Structure Elements            01/01/70 00:00      
   RE: Pointers to Structure Elements            01/01/70 00:00      
   RE: Pointers to Structure Elements            01/01/70 00:00      
   RE: Pointers to Structure Elements            01/01/70 00:00      
      RE: Pointers to Structure Elements            01/01/70 00:00      
   RE: Pointers to Structure Elements            01/01/70 00:00      
      RE: Pointers to Structure Elements            01/01/70 00:00      
         RE: Pointers to Structure Elements            01/01/70 00:00      
   RE: Pointers to Structure Elements            01/01/70 00:00      
   RE: Pointers to Structure Elements            01/01/70 00:00      
   Universal casting to structs/union/void            01/01/70 00:00      
      RE: Universal casting to structs/union/void            01/01/70 00:00      

Back to Subject List