#include #include main() { int i; int *ip; int *space; /* Declare the double pointer. Note: This can also be declared int* *ipp */ int **ipp; int number; int n,m,j,k; FILE *fp; int control =1; fp = fopen("input.dat", "r"); fscanf(fp,"%d",&n); /* Allocate the memory. Notice that the space for the double pointer is the size of an int pointer */ ip = (int*)malloc(n*sizeof(int)); ipp = (int **) malloc(n * sizeof(int*)); for(i = 0; i < n; i++) { fscanf(fp,"%d", &m); *(ip + i) = m; } for(i = 0; i < n; i++) { m = *(ip + i); /* Allocate the memory for the numbers to be stored */ *(ipp + i) = (int *) malloc(m * sizeof(int)); } /* Scan the numbers in */ for(i = 0; i < n; i++) { number = *(ip + i); space = *(ipp + i); for(j = 0 ; j < number; j++) { fscanf(fp,"%d", &k); *(space + j) = k; } } while(control == 1) { printf("which ptr do you want\n"); scanf("%d", &n); printf("for that ptr, which int \n"); scanf("%d", &m); printf("I am storing %d here\n", *( *(ipp + n) + m)); printf("Enter 1 to continue\n"); printf("Enter 2 to exit\n"); scanf("%d", &control); } }