sbrk

sbrk,英文單詞,解釋為返回值:函式調用成功返回一指針,指向下一個記憶體空間。函式調用失敗則返回(void*)-1,將errno設為ENOMEM。

基本內容

返回值:函式調用成功返回一指針,指向下一個記憶體空間。函式調用失敗則返回(void*)-1,將errno設為ENOMEM。

程式例:

#include

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;

}

相關詞條

熱門詞條

聯絡我們