I have written the following code. The thing is that when it enters the internal loop the program stacks and so the input procedure stops. Have I done something wrong?
What I do here is create an array of pointers, and each pointer points to an array - each array of different size. Then the even numbered lines take only one number, while the odd numbered lines take more.
long int K,i,j;
scanf("%ld", &K);
long int **pl_r;
pl_r = (long int **) malloc(2*K*sizeof(long int *));
for(i=0; i<K; i++)
{
pl_r[2*i] = (long int *) malloc(1 *sizeof(long int));
scanf("%ld", &pl_r[2*i][0]);
pl_r[2*i+1] = (long int *) malloc(pl_r[2*i][0] *sizeof(long int));
scanf("%ld", &pl_r[2*i+1][0]);
for(j=1; j<pl_r[2*i][0]-1; i++){
scanf("%ld", &pl_r[2*i+1][j]);
}
}