char数组的初始化字符串太长 [英] Initializer-string for char array is too long
本文介绍了char数组的初始化字符串太长的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我读过 char four [4] ="four";此语句的正确语义是什么?
我正在使用 Xcode
并编写 Objective C
代码.我不明白为什么:
I am using Xcode
and writing Objective C
code.
I don't understand why:
char words[4] = { "aardvark", "abacus", "allude", "zygote" };
发出警告
警告:语义问题:char数组的初始化字符串太长
warning: Semantic Issue: Initializer-string for char array is too long
但是
char *words[4] = { "aardvark", "abacus", "allude", "zygote" };
正常工作.请引导我.
推荐答案
我不知道整数指针和字符指针之间的区别.因此,我感到困惑.这对我有帮助: http://www.computing.net/answers/programming/why-this-works-char-pointer-in-c/4444.html
I was not aware of the differences between an integer pointer and a character pointer. Hence, I was confused. This helped me: http://www.computing.net/answers/programming/why-this-works-char-pointer-in-c/4444.html
这篇关于char数组的初始化字符串太长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文