初始化多维数组:{0}与{{{0}}} [英] Initializing a multidimensional array: {0} versus {{{0}}}

查看:148
本文介绍了初始化多维数组:{0}与{{{0}}}的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我正在分析的C代码中,有很多多维(结构)数组用不同数量的大括号初始化,例如{{0}}{{{0}}}.

In the C code I am analyzing, there are a lot of multidimensional (struct) arrays which are initialized with a different number of curly brackets e.g. {{0}} or {{{0}}}.

但是,用{0}替换它们也可以很好地工作.

However, replacing these by {0} also works perfectly.

使用一组或多组花括号({})之间是否存在(功能上的)区别?

Is there a (functional) difference between using one or more sets of curly brackets ({}) occurrences ?

推荐答案

不,没有功能上的区别. C标准允许省略中间{}.特别地,{ 0 }形式是可用于所有数据类型的初始化程序.

No, there is no functional difference. The C standard allows to leave out intermediate {}. In particular, the form { 0 } is an initializer that can be used for all data types.

这篇关于初始化多维数组:{0}与{{{0}}}的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆