[英]Initialize entire char array
I thought this would be easy, but google searching isn't turning up what I'm looking for.我认为这很容易,但谷歌搜索并没有找到我正在寻找的东西。 In C, how do I initialize an entire char array to a particular char, say,
'N'
?在 C 中,如何将整个字符数组初始化为特定字符,例如
'N'
? This is what I tried:这是我尝试过的:
char test[256] = {'N'};
But this only initializes the first index to 'N'
and the rest to 0.但这只会将第一个索引初始化为
'N'
,其余的为 0。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.