How I return the size of the pointer that I have allocate with malloc?
Posted
by drigoSkalWalker
on Stack Overflow
See other posts from Stack Overflow
or by drigoSkalWalker
Published on 2010-03-19T14:57:45Z
Indexed on
2010/03/19
15:01 UTC
Read the original article
Hit count: 170
See this example!
int main( int argc, char ** argv )
{
int *ptr = malloc(100 * sizeof (int));
printf("sizeof(array) is %d bytes\n", sizeof(ptr));
}
The printf function return only 4 bytes! What is wrong?
Thanks so much!!!
© Stack Overflow or respective owner