I was looking at the documentation of sbrk
system call and found this:
On success,
sbrk()
returns the previous program break. (If the break was increased, then this value is a pointer to the start of the newly allocated memory). On error,(void *) -1
is returned, anderrno
is set toENOMEM
.
Now,
What's the significance of
(void *) -1
?What is the exact memory address it points to? (if it does at all)
How is it guaranteed that
(void *) -1
is not a valid address that can be returned bysbrk()
on success?