討論串[問題] 關於return local pointer的問題
共 4 篇文章
首頁
上一頁
1
下一頁
尾頁

推噓1(1推 0噓 0→)留言1則,0人參與, 最新作者lungswu (宅爸爸)時間16年前 (2010/02/02 13:39), 編輯資訊
0
0
0
內容預覽:
做中學...剛剛寫了一段code.... 1 void main(void). 2 {. 3 char *s = "123";. 4 char *q = "123";. 5. 6 printf("%s\n", s);. 7 }. gcc on cygwin上驗證. gcc aa.c -g -o aa
(還有624個字)

推噓1(1推 0噓 2→)留言3則,0人參與, 最新作者flashliqu (投資自己)時間16年前 (2010/01/31 19:22), 編輯資訊
0
0
1
內容預覽:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^. 這邊有點疑問:. char *ptr = "123"; 應該是放在 literal pool 當中,. 應該是 Code segment 才對?. --. 發信站: 批踢踢實業坊(ptt.cc). ◆ From: 114

推噓5(5推 0噓 1→)留言6則,0人參與, 最新作者VictorTom (鬼翼&娃娃魚)時間16年前 (2010/01/30 01:49), 編輯資訊
0
0
1
內容預覽:
好像搞得有點亂了, 乾脆直接回一篇出來好了..... 簡單的說, 你要搞清楚回傳出function的東西來自何處..... 另外就是, 分清楚討論的是指標變數本身, 還是存的值..... ==. int* func(void). {. int iLocal;. int *ptr = &iLocal;
(還有1133個字)

推噓8(8推 0噓 39→)留言47則,0人參與, 最新作者stellvia7 (stellvia)時間16年前 (2010/01/29 16:47), 編輯資訊
0
0
0
內容預覽:
關於return local pointer的問題. (1). char* test(). {. char tmp[30]="abc";. return tmp;. }. int main(). {. printf("%s\n",test());. }. 上述由於tmp是local 變數會在test
(還有453個字)
首頁
上一頁
1
下一頁
尾頁