let's say we have allocated a memory of 100 bytes.
char *ptr = (char*) malloc(sizeof(char)* 100);
Now suppose, I write more than 100 bytes at this location.
strcpy(ptr, <Buffer greater than 100bytes say 120 bytes>);
or
memcpy(ptr,'6',120);
Why do u observe a crash.. What is the reason behind this? How can this be be explained.
Or suppose we have to write our own Memory Allocation library what data strucutres are to be used and how should we start with this?
-- Amit Sahrawat
News