0
How to get ride of this warning plz?
4 Answers
+ 1
Either use designated initialiser for the integer fields( like you did for double ones ) of union or put an extra brace to initialise the union field of the struct to initialise the union.
Here's the fix đ
https://code.sololearn.com/cWDml5PTv4wr/?ref=app
+ 1
Thank u.
But why i should put braces ?
+ 1
Ahmed Mahmoud because second member of the struct is an union and that is how you initialise an union.
Cpp reference says " When initializing an object of struct or union type, the initializer must be a non-empty, brace-enclosed, comma-separated list of initializers for the members "
See this for more info about initialising structs and unions đ
https://en.cppreference.com/w/c/language/struct_initialization.
+ 1
Thank u so much đ