typedef可以和结构体struct配合使用:作用为给struct结构体起个别名。
//结构体名字是example_fruit struct example_fruit{ const char *fruit_name; int price; float weight; //结构体中可以包含其他的结构体。 struct color; }; //typedef作用为给结构体起个别名,用法如下: typedef struct example_fruit{ const char *fruit_name; int price; float weight; struct color; }fruit;
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)