c中的多维数组 [英] multidimensional array in c

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

问题描述

为什么我不能在main函数中初始化多维数组?

Why i can''t initialize multidimensional array in main function?

int main()
{
arr[10][10][10];
int a,b,c;
}

推荐答案

数组是什么?你的数组元素需要类型

Array of what? You need a type for your array elements.
int arr[10][10][10];





在实践中,这可能不是一个好主意,因为它可能会使数组访问代码有些复杂化,如果有任何超过
$ b $的话它几乎没有什么优势b



In practice this may not to be a good idea as it can complicate the array access code somewhat and it has very little advantage if any over

int arr[1000];





没有什么可以阻止你将其视为多维数组任何你可能会发现代码实际上更容易编写。

你真的喜欢你。



There''s nothing to stop you treating this as a multidimensional array any you may find the code actually turns out to be easier to write.
Up to you really which you prefer.


这篇关于c中的多维数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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