ZaidaZadkiel avatar

C struct intialization warning about braces solution

zaidazadkiel

Published: 17 May 2017 › Updated: 17 May 2017

C struct intialization warning about braces solution

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};

Leave C struct intialization warning about braces solution to:

Written by

I am a vagrant artist from México

Read more #programming posts


Best Posts From ZaidaZadkiel

We have not curated any of zaidazadkiel's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From ZaidaZadkiel