Borland C++ reference

free

raw OCR

Frees allocated block.

Defined in header <alloc.h>

Syntax

#include <alloc.h>
void free(void *block);

Portability

DOSUNIXWindowsANSI CC++ only
■■■■

Remarks

free deallocates a memory block allocated by a previous call to calloc, malloc, or realloc.

Return value

None.

See also

Example

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

int main (void)
{
   char *str;
   /* allocate memory  for string */
   str =  (char *) malloc(lO);

   /* copy "Hello" to string  */
   strcpy(str, "Hello");
   /* display string */
   printf("String is %s\n",  str) ;

   /* free memory */
   free(str);
   return 0;

Differences from modern implementations

Nothing recorded yet.

Modern references

These are search links, not yet checked by hand.