C struct intialization warning about braces solution

in #programming7 years ago

In C when initializing a struct and one of the members is array or union, you have to put {}'s surrounding this element.
otherwise you get a warning about braces.

struct list {
int type;
union {
int d;
float f;
char *s;
list *l;
env *e;
name *n;
} data;
list n; / next list, if == NULL, this is the last element */
};
static list list_empty = { 4, {0}, NULL};

Coin Marketplace

STEEM 0.35
TRX 0.12
JST 0.040
BTC 70601.11
ETH 3576.21
USDT 1.00
SBD 4.78