EmbLogic's Blog

project 01

when we reallocate memory to pointer then it will not receive the address of other position it will allocate space next to the previous address…..if there is data at next position then if we write it will overwrite previous data..

2 Responses to project 01

  1. Ganesh Kale says:

    No because when there is no further contigous free memory it will give you an error and -1 return value.Every process has its own context so other process cannot take memory of other processes without its permission………

  2. when u ask for more memory from a same location using realloc, it returns the same memory location if the asked no of memory blocks are available..else it will move the previous data from the same location to he new address where the blocks are available and returns the new address

    thus realoc should be used as

    ptr = (char *)realloc(ptr,10*sizeof(char));

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>