Crossware

Table of Contents        Previous topic       Next topic       

C COMPILER LIBRARY FUNCTIONS->Detailed Descriptions->sbrk()

Summary

#include <malloc.h>

char* sbrk(int n);    Set memory break value

n    Number of bytes to be added to break value


Description

This function increments the memory break pointer by the nbytes bytes.  If n is odd, it is rounded up to an even number to ensure that the memory pointer continues to be correctly aligned for all objects.

sbrk() is used by malloc() and the user should preferably use malloc() rather than sbrk().


Return Value

The routine returns the old break value.  If insufficient memory is available, then -1 is returned.