#include<stdio.h>
int main(){
int n;
printf("Enter a value for n\n");
scanf("%d",&n);
int A[n];
}
Why can't I assign the size of an array explicitly from a user?
#include<stdio.h>
int main(){
int n;
printf("Enter a value for n\n");
scanf("%d",&n);
int A[n];
}
Why can't I assign the size of an array explicitly from a user?
There is VLA support in C99 and C11 (optional). With GCC 7.2.1 your example works. I compiled like this:
gcc abc.c -o abc
gcc --std=c99 abc.c -o abc
Looks like your compiler does not support this feature.