I am experimenting with malloc and I am trying to create a dynamic 2D array, I know the size of the second dimension and I am allocating memory like so:
int (*arr)[SIZE] = NULL;
arr = malloc(sizeof(arr[SIZE]) * 10);
My question is, is it possible place the above code into a function, and return the address of the allocated memory, if so what should the type be?
Edit: I am aware of the other method of allocating and return a pointer to a pointer.
Thanks in advance.