int **ptr; *ptr = (int *)malloc(10 * sizeof (*val));
The first statement declares a double pointer.
The second markup of the pointer. So that you can dereference it, the pointer must point to some valid memory. this does not mean segregation.
If you need to allocate enough memory for an array of pointers, you need:
ptr = malloc(sizeof(int *) * 10);
Now ptr points to a memory large enough to hold pointers 10 to int .
Now each element of the array, which is a pointer, can be obtained using ptr[i] , where
i < 10
source share