[英]What's the difference between typedef char[4] A and typedef char (&A)[4]?
What's the difference between 之间有什么区别
typedef char[4] A;
and 和
typedef char (&A)[4];
? ?
Now I'm just trying to meet post quality standards by writing at least one complete sentence, since my question was already clear at the title. 现在,我想通过写至少一个完整的句子来达到后期质量标准,因为标题上我的问题已经很清楚了。
typedef char[4] A;
This is an invalid attempt to declare a typedef for an array. 这是为数组声明typedef的无效尝试。
typedef char (&A)[4];
This declares a typedef for a reference to an array, which is not the same as an array. 这声明了一个typedef来引用一个与数组不同的数组。
To make the first one valid it should be typedef char A[4];
要使第一个有效,应使用
typedef char A[4];
but that's still a typedef for an array, which is still different to the second one. 但这仍然是数组的typedef,仍然与第二个数组不同。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.