I've read that C89 does not support variable-length arrays, but the following experiment seems to disprove that:
#include <stdio.h>
int main()
{
int x;
printf("Enter a number: ");
scanf("%d", &x);
int a[x];
a[0] = 1;
// ...
return 0;
}
When I compile as such (assuming filename is va_test.c
):
gcc va_test.c -std=c89 -o va_test
It works...
What am I missing? :-)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…