C - byte array to structure (dns query)

前端 未结 1 1584

I have these structures:

typedef struct dnsQuery {
  char header[12];
  struct TdnsQuerySection *querySection;
} TdnsQuery;

typedef struct dnsQuerySection {
  u         


        
1条回答
  •  悲&欢浪女
    2021-01-27 05:32

    your query section printer is an incomplete type. you need to either typedef it beforehand and not use the structure keyword or use the structure name rather than the typedef. e.g.:

    typedef struct foo Foo;
    
    struct {
        Foo* querySection;
        // effectively same as above
        struct foo* querySection2;
    
        // NOT the following. 
        struct Foo* querySectionWrong; 
    }; 
    

    0 讨论(0)
提交回复
热议问题