> farrealloc<ALLOC.H> ~ Online tutorial

farrealloc



 farrealloc<ALLOC.H>
 
   farrealloc adjusts allocated block in far heap

 Declaration:


  void *realloc(void *block, size_t size);

 Remarks:


farrealloc adjusts the size of the allocated block to nbytes, copying the
contents to a new location, if necessary.

 Return Value:


   On success, both functions return the address of the reallocated block,
    which might be different than the address of the original block.
 
Program.


#include <stdio.h>
#include <alloc.h>

int main(void)
{
   char far *fptr;
   char far *newptr;

   fptr = (char far *) farmalloc(16);
   printf("First address: %Fp\n", fptr);

   /*  we use a second pointer, newptr, so that in the case of */
   /*  farrealloc() returning NULL, our original pointer is    */
   /*  not set to NULL.                                        */

   newptr = (char far *) farrealloc(fptr,64);
   printf("New address  : %Fp\n", newptr);
   if (newptr != NULL)
      farfree(newptr);
   return 0;
}



Please Give Us Your 1 Minute In Sharing This Post!
Please Give Us Your 1 Minute In Sharing This Post!
SOCIALIZE IT →
FOLLOW US →
SHARE IT →
Powered By: BloggerYard.Com

0 comments: