`
Poechant
  • 浏览: 211466 次
博客专栏
Bebe66e7-3a30-3fc9-aeea-cfa3b474b591
Nginx高性能Web服务...
浏览量:23478
5738817b-23a1-3a32-86de-632d7da73b1e
Cumulus实时媒体服务...
浏览量:21384
社区版块
存档分类
最新评论

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

 
阅读更多

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

-

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics