As far as I know in C you cannot create an array of a lenght an integer read either on a file or introduced by the user, so the instruction
should give you compilation problems.
Another command line that should give you problems is
Should say
if what you want to print is the so-called array dimension.
If you can explain more about you assignment I could help, but the only way I know to do it is by using dynamic memory allocation (i.e. malloc). For what I understand is being able to create an array of any size, entering the size by the user. In general should be something like:
Code:
#include<malloc.h>
int main(){
int n;
int *key;
printf("How many keys? ");
getchar();
n=getchar();
key = (int*) malloc(n *sizeof(int));
for(i=0;i<n;i++)
{
key[i] = i;
printf("%d ", key[i]);
}
printf("\n");
return 0;
}
This program should create an array of size n and fill it with the first n naturals (starting at 0).
Hope this help.