English
Language : 

CC78K0S Datasheet, PDF (224/520 Pages) NEC – C Compiler Ver.1.30 or Later Language
CHAPTER 10 LIBRARY FUNCTIONS
5-11 brk
sbrk
Utility Functions
FUNCTION
The memory function brk sets a break value.
The memory function sbrk increments or decrements the set break value.
HEADER
stdlib.h
FUNCTION PROTOTYPE
int brk(char *endds);
char *sbrk(int incr);
Function
brk
sbrk
Arguments
endds ... Break value to be
set block to be released
incr ... Value (bytes) by which
set break value is to be
incremented/decremented.
Return Value
• 0 if break value is set
properly
• –1 if break value cannot be
changed
• Old break value if
incremented or
decremented properly
• –1 if old break value cannot
be incremented or
decremented
EXPLANATION
brk
• The brk function sets the value given by endds as a break value (the address next to the end address of an
allocated block of memory).
• If endds is outside the permissible address range, the function sets no break value and sets errno to
ENOMEM (3).
sbrk
• The sbrk function increments or decrements the set break value by the number of bytes specified by incr.
(Increment or decrement is determined by the plus or minus sign of incr.)
• If the incremented or decremented break value is outside the permissible address range, the function does
not change the original break value and sets errno to ENOMEM (3).
224
User’s Manual U14872EJ1V0UM