Tuesday, 17 April 2012

In the expression, char *c = (char *)malloc(20); followed by free(r); explain the role of mallocQ operator in allocating the number of bytes? | C++

Implementation is the main factor associated with the allocation of number of bytes with the help of the mallocQ operator. The malloc() operator includes the number of bytes allocated + 4 bytes. In the given expression, malloc() allocates 24 bytes. 4 bytes is used for storing the number of bytes allocated. It means 20 bytes can be accessed from char.

No comments: