Chinaunix首页 | 论坛 | 博客
  • 博客访问: 519856
  • 博文数量: 184
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1172
  • 用 户 组: 普通用户
  • 注册时间: 2016-06-21 13:40
个人简介

技术改变命运

文章分类

全部博文(184)

文章存档

2020年(16)

2017年(12)

2016年(156)

我的朋友

分类: C/C++

2016-07-09 18:43:29

    传统的C语言是不能像C++那样支持变长数组的,也就是说数组的长度是在编译期就确定下来的,不能在运行期改变。C99标准定义的C语言新特性,新增的一项功能可以允许在C语言中使用变长数组。
 C99 gives C programmers the ability to use variable length arrays, which are arrays whose sizes are not known until run time. A variable length array declaration is like a fixed array declaration except that the array size is specified by a non-constant expression. When the declaration is encountered, the size expression is evaluated and the array is created with the indicated length, which must be a positive integer. Once created, variable length array cannot change in length. Elements in the array can be accessed up to the allocated length; accessing elements beyond that length results in undefined behavior. There is no check required for such out-of-range accesses. The array is destroyed when the block containing the declaration completes. Each time the block is started, a new array is allocated.
    以上就是C99标准对C语言变长数组的说明。

阅读(1017) | 评论(0) | 转发(0) |
0

上一篇:约瑟夫斯问题

下一篇:c语言中的输入函数

给主人留下些什么吧!~~