Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Turbo C - <b>brk() change data-segment space allocation</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
brk()                    Change Data-Segment Space Allocation

 #include   <alloc.h>

 int        brk(endds);
 void       *endds;                      New ending address

    brk() dynamically changes the amount of space allocated to the
    calling program's data segment.  It does this by resetting the
    program's 'break value', which is the address of the first location
    beyond the end of the data segment.  brk() sets the 'break value' to
    'endds'.  The amount of allocated space increases as the break value
    increases.

    Returns:    If successful, 0 is returned.  On failure, -1 is returned
                and 'errno' (defined in <stdlib.h>) is set to ENOMEM, not
                enough core.

      Notes:    brk() will fail without making any changes is such a
                change would result in more space being allocated than is
                allowable.

See Also: coreleft() sbrk()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson