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

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -