[Cexpert-002] How to assign default values to fields/members of a struct?

鍾超發表於2012-04-04

How to assign default values to fields/members of a struct?


It's a basic skill for a c programmer.


typedef struct {
    unsigned    len:28;
    unsigned    valid:1;
    unsigned    no_cacheable:1;
    unsigned    not_found:1;
    unsigned    escape:1;
    u_char     *data;
} variable_value_t;


Yes, just use a colons with a default value :)


-

Poechant

-

相關文章