C: How does nested braces for array of struct initialization work? -
struct mystruct s[10] = {{0}};
this appears initialize array of structs 0. how nested braces syntax work?
any fields not specified initialized zero. here have array of structs. you're initializing first element of array structure initializer initializes first element of structure zero. rest of first structure , rest of array elements 0 too. it's nice idiom.
Comments
Post a Comment