Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ free(3C) — DG/UX 4.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought



                                                                 free(3C)



        _________________________________________________________________
        free                                                     function
        Release allocated memory.
        _________________________________________________________________


        Calling Sequence

        #include <stdio.h>

        char *fp;
        void free();
        free(fp);

        where fp is a pointer to the allocated memory.


        Description

        This function frees the storage that the fp pointer points to.
        You must have previously allocated the area with alloc, alloca,
        calloc, malloc, or realloc.

        Since the hardware representations for byte and word pointers
        differ, stdio.h defines a free macro to convert the argument to a
        byte pointer before doing the call.


        Returns

        The free function does not return a value.


        Related Functions

        See also the alloc, alloca, calloc, malloc, and realloc
        functions.


        Example

        /* Program test for the free() function */

        #include <stdio.h>

        char  *p, *alloc();
        void free();

        main() {
            p = alloc(100);
            printf("Allocated %o\n", p);



        DG/UX 4.00                                                 Page 1
               Licensed material--property of copyright holder(s)





                                                                 free(3C)



            free(p);
            printf("Area released.\n");
        }



















































        DG/UX 4.00                                                 Page 2
               Licensed material--property of copyright holder(s)





                                                                 free(3C)



        A call to the program test generates the output

        Allocated 34003703624
        Area released.


















































        DG/UX 4.00                                                 Page 3
               Licensed material--property of copyright holder(s)



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026