英寸;;什么是CHAR温度[3] =&QUOT是什么意思?

英寸;;什么是CHAR温度[3] =&QUOT是什么意思?

问题描述:

通常情况下,

char example[5]="cat";

如果您(只是一个双引号无空格)初始化什么呢?结果
会有什么初始化之后的字符数组中的元素?

What if you initialize it with "" (just a double quotes without spaces)?
What will be the elements in the character array after initialization?

声明

char    temp[3] = "";

是一样的。

char    temp[3] = {0};
                  // `\0` ascii value is 0

记住保持与 0 初始化一半初始化数组的元素。

remember remaining elements of half initialized array initialized with 0.

点:字符临时[3] =容易到键入骨节病>(指写作),所以其preferable。

Point :char temp[3] = "" is easy to type(means writing), so its preferable.

看甚至可以与该声明比较字符临时[3] = {'\\ 0'}; (它需要更多的字符为键入骨节病> ),而在字符临时[3] =; 很简单(甚至没有类型不匹配 - INT /字符)。

Look even compare it with this declaration char temp[3] = {'\0'}; (it need more chars to type) Whereas in char temp[3] = ""; is simple (even no type mismatch - int/char).