变长数组
来源:互联网 发布:阿沁的淘宝店链接 编辑:程序博客网 时间:2024/05/01 19:01
C99标准引入了变长数组的概念,它允许使用变量定义数组各维。
例如:
int quarters =4;int regions =5;double sales [quarters ][regions ];//一个变长数组
标准的二维变长数组参数的函数声明为
int sum2d (int rows, int cols,int ar[rows][cols]);注意:
前两个参量(rows,cols)用作数组参量ar的维数。因为ar的声明中使用了rows和cols,所以在参量列表中,他们两个的声明需要遭遇ar。因此以下的原型是错误的
int sum2d (int ar[rows][cols],int rows, int cols);//顺序不正确
而且,C99标准规定,可以省略函数原型的名称;但是如果省略名称,则需要用星号来代替省略的维数:<pre name="code" class="html">int sum2d (int , int ,int ar[*][*]);变长数组中的“变”并不表示在创建数组后,用户可以修改数组的大小。变长数组的大小在创建后是保持不变的。“变”的意思是指其维大小可以用变量来指定。
0 0
- 变长数组
- 变长数组
- 变长数组
- 变长数组
- 变长数组
- 变长数组
- 变长数组
- 变长数组
- 变长数组
- 变长数组
- 变长数组
- 变长数组
- C语言变长数组
- 变长数组和alloca
- PL/SQL变长数组
- C语言变长数组
- 变长(柔性)数组
- PL/SQL变长数组
- How to generate Hibernate mapping files & annotation with Hibernate Tools
- STL中的常用算法
- QQ分享无法回调的问题
- php大型网站开发优化方案
- 计算机网络-TCP/IP协议三次握手与四次握手流程解析
- 变长数组
- Ectiture impossible,doublon dans une cle de la错误
- Hibernate使用count(*)取得表中记录总数
- 不必要的优化
- 5个主流的HTML5开发工具分享
- C++编码命名规范 -- 目前应用
- (大数据分析-2)mapReduce Review
- 堆和栈的区别(转过无数次的文章)
- js 闭包概念