假設我有這個結構
typedef struct
{
int AM;
char* name, surname;
}Item;
我想用 AM = -1 和 NULL name/surname 定義一個常量 NULLitem。有沒有辦法用#define 做到這一點?
uj5u.com熱心網友回復:
#define NULLitem (const Item){ .AM = -1, .name = NULL, .surname = NULL }
那是一個 C99復合文字。
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/473135.html
