Let we declare a pointer
int *ptr;
ptr=malloc (10 *sizeof (int));
free (ptr);
The question is how free()
will free memory. Let int
be of 4 bytes and the memory will be 40 bytes for int
.
The compiler will understand to remove first memory location provided by malloc
but how it will clear another 9 int data that is other 36 bytes?