error: invalid conversion from ‘const char*’ to ‘char’ [-fpermissive]
資深大佬 : XIVN1987 6
《 C++ Crash Course 》上有个例程如下:
“` c++
struct JohanVanDerSmut
{
bool gold = true;
int year_of_smelting_accident{1970};
char key_location[8] = {“x-rated”};
};
“`
“` c++
struct JohanVanDerSmut
{
bool gold = true;
int year_of_smelting_accident{1970};
char key_location[8] = {“x-rated”};
};
“`
我编译后程序报错:
error: invalid conversion from ‘const char*’ to ‘char’ [-fpermissive]
char key_location[8] = {“x-rated”};
^
是编译器版本的问题吗??我用的是 gcc 5.4
大佬有話說 (8)