Accessing structure members in C
Actually few hours back, I had posted a question but there was some error in my question (My bad!!). I want to access the members of a structure (profile_t) which is placed inside a structure (profile_datagram_t) and profile_t is a array of structs....
struct profile_t
{
unsigned char length;
unsigned char type;
unsigned char *data;
};
typ开发者_Python百科edef struct profile_datagram_t
{
unsigned char src[4];
unsigned char dst[4];
unsigned char ver;
unsigned char n;
struct profile_t profiles[MAXPROFILES];
} header;
This sets the length of the first profile in the headers to 10:
header h;
h.profiles[0].length = 10;
精彩评论