ganjun 发表于 2021-4-24 17:02:51

关于c++的char数组的问题

#include<iostream>
#include<cstring>
#include<string>

using namespace std;

int main()
{
        const char ch[] = { "ling","yi","er","san","si","wu","liu","qi","ba","jiu" };

        return 0;
}

为什么这里不能用char ch={ "ling","yi","er","san","si","wu","liu","qi","ba","jiu" };

应该不是const的问题.

人造人 发表于 2021-4-24 17:11:29

const char *ch={ "ling","yi","er","san","si","wu","liu","qi","ba","jiu" };
页: [1]
查看完整版本: 关于c++的char数组的问题