I have a console-input space separated list of integers of n length(n is read in through the console) which needs to be split into the integers and placed in an array of size n. I have attempted this with both fscan and fgets, to either a segmentation fault or the console locking and not letting me enter the list. Any advice:
int main()
{
        int n;
        scanf("%d", &n);
        int buffer = n + n -1;
        char input[buffer];
        //char * input;
        //int buffer = n+n-1;
        //fgets(input, buffer, stdin);
        scanf("%*c", &input);
        printf("c is %c", input[0]);
        char * end;
        long int l;
        end = input;
        int base = 10;
        int ele = 0;
        long int vals[n];
        while(l = strtol(end, &end, base)){
                vals[ele] = l;
                ele += 1;
        }
        return 0;
 
     
    