C语言变长数组是否只能拥有自动存储期限?
rt,是不是变长数组只能拥有自动存储期限,而拥有静态存储期限的就不会被视为变长数组?
e.g.:
#include <stdio.h>
int n = 10;
int a[n] = {...};
int main(void)
{
for (int i = 0; i < n; i++)
printf("%d", a[i]);
return 0;
}
是非法的
#include <stdio.h>
int main(void)
{
int n = 10;
int a[n] = {...};
for (int i = 0; i < n; i++)
printf("%d", a[i]);
return 0;
}
是合法的?
泡沫的幻想
9 years, 7 months ago