本文介绍了所有维度中包含1个元素的多维数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题可能看起来很有趣,但以下声明是否相同?


unsigned char a;

unsigned char b [1];

unsigned char c [1] [1] [1];


我的编译器为a存储一个字节,一个用于b,一个用于c。那么可以像第3行一样声明一个数组吗?或者这是一个捕获?例如,c [0] [0] [0]的处理速度会慢于?


谢谢。

解决方案




The question may look funny, but are the following declarations equivalent?

unsigned char a;
unsigned char b[1];
unsigned char c[1][1][1];

My compiler stores one byte for a, one for b and one for c. So is it OK to declare an array like line 3 or is this a catch somewhere? For example will c[0][0][0] be processed slower than a?

Thanks.

解决方案




这篇关于所有维度中包含1个元素的多维数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 05:18