C++ 中 char* 数组的初始化问题
如果要将一个char*数组初始化为下面这几个字符串要怎么做{"one","two","three","four","five"}是初始化而不是赋值...
如果要将一个char*数组初始化为下面这几个字符串要怎么做{"one","two","three","four","five"}是初始化而不是赋值
展开
2个回答
2013-08-04
展开全部
char *str={"one","two","three","four","five"};等价char str[]={"one","two","three","four","five"};
2013-08-04
展开全部
char *pNumbers = { "one", "two", "three", "four" };
cout << pNumbers[2]; // 输出 three
cout << pNumbers[2]; // 输出 three
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询