Hi, the code below gives me an error: too many initializers, referring to the union initializing line. Why is it incorrect and what what should I do instead? Thanks.
But, admittedly, turn the compiler error messages up and my g++ compiler says:
try2.cpp: In function 'int main()':
try2.cpp:23:29: warning: C++ designated initializers only available with -std=c++2a or -std=gnu++2a [-Wpedantic]
union_example u = { .name={ 'h', 'e', 'l', 'l', 'o', '\0' } };