EmbLogic's Blog

memory allocation

ptr=malloc(sizeof(char)*4);

if length of available characters in string is more than 4 then memory allocation to pointer cross the limit but it does not affect the output to print the string.

One Response to memory allocation

  1. Shiv Maurya says:

    It does not affect the output to print the string even if it goes/accesses out of the memory bounds allocated to it. But it may not get affected until that out of the bound memory is either not over-written by the process which owns it or it is still not allocated to any process by the operating system.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>