开发者

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;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜