This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

why there is no memlen();


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]