Initializing a struct with malloc

前端 未结 0 1539
灰色年华
灰色年华 2021-01-29 05:15

To create a struct I can do one of the following:

// Method 1
Item *item = malloc(sizeof(Item));
Item _item = {.name="job"};
Item = &_Item;

// Meth         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题