[not the answer to the question, but indented using the correct answer, as indicated by others)
To access the void pointer array as an int array by doing this
int **m = (int **)mdeclaraMatrice(n,m,sizeof(int));
incorrect, since only C-Standard void* correctly converted to any other pointer, void** not necessary. Therefore he must be
void ** ppv = mdeclaraMatrice(n,m,sizeof(int)); int * pi = *ppv;
Then access the items as follows:
pi[0] = 42 pi[1] = 43; ...
This is essentially the same as doing
*((int *) (pi + 0)) = 42; *((int *) (pi + 1)) = 43;
which really doesn't make sense, since pi already int* , so a completely correct approach (also taking into account the 2nd dimension) would be as follows:
((int *)(ppv[0]))[0] = 42; ((int *)(ppv[0]))[1] = 43;
What can be made usable by discarding the macro:
#define GENERIC_ARRAY_ELEMENT(type, address, r, c) \ ((type *)(address[r]))[c] GENERIC_ARRAY_ELEMENT(int, ppv, 0, 0) = 42; GENERIC_ARRAY_ELEMENT(int, ppv, 0, 1) = 43;