why there is no memlen();

Arunachalam G arunachalam@deeproot.co.in
Wed Oct 30 06:11:00 GMT 2002


Hi all,

is there any way to get the amount of memory allocated to a
pointer.

    ...
    char *m;

    m = (char *)malloc(sizeof(char) * 120);
    strcpy(m, "y no memlen");
    ...

in the above code strlen(m) will give  11. Is there any way to get the
amount of memory allocated to it, so that it should give 120.
and why there is no memlen() function in libc. any reason for this?

thanks
arun.



More information about the Gcc-help mailing list