I have a simulated 2D array using pointers with malloc and I want to get the size of that array, since sizeof() returns me the size of the pointer. My code (ANSI C):
void main(){
int s1=10;
int s2=15;
int ** rack=(int**)malloc(s1*sizeof(int**));
for(int i=0; i<s1; i++) rack[i]=(int*)malloc(s2*sizeof(int*));
}
I want a function (may by system, may do it myself) this way:
size(rack) //returns 10
size(rack[0]) //returns 15
Thanks in advance! (For more info I use GNU/Linux)