delorie.com/djgpp/doc/libc/libc_78.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

brk

Syntax

 
#include <unistd.h>

int brk(void *ptr);

Description

This function changes the break for the program. This is the first address that, if referenced, will cause a fault to occur. The program asks for more memory by specifying larger values for ptr. Normally, this is done transparently through the malloc function.

Return Value

Zero if the break was changed, -1 if not. errno is set to the error.

Portability

ANSI/ISO C No
POSIX No

Example

 
if (brk(old_brk+1000))
  printf("no memory\n");


  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004