char数组的Initializer-string太长

时间:2012-03-26 17:20:06

标签: objective-c xcode arrays

我读过 char four[4] = "four"; What are the correct semantics for this statement?

我正在使用Xcode并撰写Objective C代码。 我不明白为什么:

char words[4] = { "aardvark", "abacus", "allude", "zygote" };

发出警告

  

警告:语义问题:char数组的Initializer-string太长

char *words[4] = { "aardvark", "abacus", "allude", "zygote" };

工作正常。 请指导我。

1 个答案:

答案 0 :(得分:1)

我不知道整数指针和字符指针之间的区别。因此,我很困惑。这对我有所帮助: http://www.computing.net/answers/programming/why-this-works-char-pointer-in-c/4444.html