int a;
scanf("%d",a);
typedef struct mylist {
int info[a];
struct mylist *link;
} Node;
this is my very simple struct and variable 'a' that don't work.
The thing which I want my program to do is to read input from the user and insert the digit into the struct (the user can determine the size of the array), however, I don't know how to do it since I get an error:
"variably modified ‘info’ at file scope".
I want to know whether it is possible to do this in a simple way.
scanf("%d", a);should bescanf("%d", &a);int *info;and usemalloc:Node n;,n.info = malloc((sizeof int) * a);.struct.