[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.
Interview Questions and Answers :: Juniper Network

2. Allocate the memory for 2 int*. and free it. Now I had question. How free will know how many byte memory has to free.

Answer:

int *p;
p = (int *) malloc(2 * sizeof (int));

When memory allocation is done, the actual heap space allocated is one word larger than the requested memory. The extra word is used to store the size of the allocation and is later used by free( )

Post Your Answer Here:      Public      Private

Rate This: +2 -0
Report     

Post Your Reply Here:     

Report Error

Report Error

Please Login First Click Here