初始化不编译的结构数组

Ang*_*ber 0 c arrays

在下面的代码中,一组卡片编译好,但一组会计师没有.为什么?有没有办法解决行为?

struct card {
    int value;
    int cost;
};

struct accountant
{
   const char* name;
   double salary;
};

int main() {

    card cards[] = { {1, 1}, {2, 2}, {3,3} };  // compiles ok

    // error C2065: '“Josh”' : undeclared identifier
    // error C2065: '“Kate”' : undeclared identifier
    // error C2065: '“Rose”' : undeclared identifier
    accountant accts[] = { {“Josh”, 2100.0}, {“Kate”, 2900.0}, {“Rose”,1700.0} };
Run Code Online (Sandbox Code Playgroud)

}

use*_*751 9

您可能会注意到,在“Josh”不正常的引号.它们通常被称为智能引号,虽然它们看起来更好,但它们并不是编译器所期望的.您是否从Microsoft Word(或类似)中复制粘贴?

将引号更改为".