Write a function to find exact size of dynamically created * variable ?
Guys it is working but for static allocation only...
int alp=0;
printf("%d",(char*)(&alp+1)-(char*)(&alp));
it will return 4 correct size, which is size of int at 32 bit machine but not working with dynamically allocated pointer variable.
char *c=(char *)malloc(12*sizeof(char));
How to find size of *c which is actually 12 here ??
please Help me to write a function to find dynamically allocated memory.