2011年12月26日

摘要: 不常见的C数组初始化方法。1 static int collection[] =2 {3 [5] = 100,4 [1] = 505 };C99新特性之一Designated initializer. 允许不按照下标顺序初始化数组。数组大小值可选写法 1- 不指定数组大小,数组大小为最大下标+1static int collection[] =写法 2- 指定数组大小,不少于最大下标+11 static int collection[6] =2 {3 [5] = 1004 };编译器支持gcc 支持。C89模式的gcc通过GNU extension支持g++ 不支持VC... 阅读全文
posted @ 2011-12-26 15:09 Feilian 阅读(120) 评论(0) 推荐(0) 编辑

导航