What is the difference between {} and {0} as initializing a structure?

Is there any difference between this:

struct something s = {};

And this?

struct something s = {0};

From all that I know, both initialize each member to zero.

+4
source share
1 answer

struct something s = {};invalid C (unless they added it to C11) , but valid C ++. GCC seems to allow it in C programs as an extension (although I don't see it in the docs http://gcc.gnu.org/onlinedocs/gcc/C-Extensions.html , but I could just skip it).

++ " ", , ( ).

+8

All Articles