討論串[問題] 請問malloc的用法
共 2 篇文章
首頁
上一頁
1
下一頁
尾頁

推噓1(1推 0噓 1→)留言2則,0人參與, 最新作者sunneo (艾斯寇德)時間18年前 (2007/09/21 16:32), 編輯資訊
0
0
0
內容預覽:
沒差別. malloc只是發出一個訊號去syscall,跟作業系統要一塊記憶體. 至於他是什麼型別,由指標來解釋. 因為malloc原型. void* malloc(size_t blocksize);. int* ptr = malloc(sizeof(int*)*size);. int型別的指標
(還有549個字)

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者ultrafire時間18年前 (2007/09/21 15:25), 編輯資訊
0
0
0
內容預覽:
int *ptr;. 1. ptr = malloc(sizeof(int*) * size);. 2. ptr = (int*)malloc(sizeof(int) * size);. 請問一下. 這兩種用法在意義上或allocate出來的記憶體. 有什麼差別呢?. --. 發信站: 批踢踢實
首頁
上一頁
1
下一頁
尾頁