sbrk一種函式,能夠修改程式BSS段的大小。
基本介紹
- 中文名:sbrk
- 性質:函式名
- 功 能:修改程式BSS段大小
- 用 法: char *sbrk(int incr)
程式例:
#include <stdio.h>
#include <alloc.h>
int main(void)
{
printf("Changing allocation with sbrk()\n");
printf("Before sbrk() call: %lu bytes free\n",
(unsigned long) coreleft());
sbrk(1000);
printf(" After sbrk() call: %lu bytes free\n",
(unsigned long) coreleft());
return 0;
}