In malloc, u wud hav to manage free memory too, avoid fragmentation etc On Mon, Aug 8, 2011 at 5:29 PM, Prem Krishna Chettri <hprem...@gmail.com>wrote:
> If U Knw the inner DS of MM.. I can help U ... > > > MALLOC :-> > > Jst retrun the add of the pointer from where U shoud start the > Allocation to the point upto where U want. > > > Say :- > Memeory is a chuck of space which can be represented by my global > array like char Heap[1000]; Considering 1000 is the total heap size. Now I > wll take a counter variable like int Count=0; to calculate the data being > occupied. > > > Now here is your malloc :- > > > void * malloc ( int size) > { > void * loc = (void *) &Heap[Count]; > Count=Count + size; > retrun loc; > } > > > Now there is many flavour and check which I can explain U but probably this > is not the better way to give Demo.. > > > enjoy .. > > > On Mon, Aug 8, 2011 at 5:23 PM, Aditya Virmani > <virmanisadi...@gmail.com>wrote: > >> implementing these functions is not tht an easy task...google it...u ll >> find malloc for sure...thr r diff versions available. >> >> >> On Mon, Aug 8, 2011 at 10:56 AM, Aman Kumar <amanas...@gmail.com> wrote: >> >>> Hiii >>> >>> >>> tell me how to implement own realloc and malloc and free function? >>> >>> any link for this?? >>> >>> If anybody is implemented it,give code ? >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Algorithm Geeks" group. >>> To post to this group, send email to algogeeks@googlegroups.com. >>> To unsubscribe from this group, send email to >>> algogeeks+unsubscr...@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algogeeks@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.