最先想到的方法是这样: define('SIGN_CODE', array('9df512','59gf1g','5eg7h1','g1agf5','f5e151','g51gfr','a5481s')); 运行报错:Warning: Constants may only evaluate to scalar values in 原因是:define常量的值:仅允许标量和 null.标量的类型是 integer, float,string 或者 boolean.所以数组是不允许的 通常做法是采用
较早的编译器是不同意这样做的,所以一些书籍比方以Tc解说的书本都说数组的下标不能是变量.在vc6.0下亦是如此. 只是在一些较新的编译器如dev c++已经支持了,例如以下代码不会报错 #include <stdio.h> #include <stdlib.h> int main() { int a; int i; scanf("%d",&a); int c[a]; ;i<a;i++) scanf("%d",&c[i])
C_struct中的长度可变数组(Flexible array member) Flexible array member is a feature introduced in the C99 standard of the C programming language (in particular, in section §6.7.2.1, item 16, page 103). It is a member of a struct, which is an array without a g