討論串[問題] 字串指標問題...
共 4 篇文章
首頁
上一頁
1
下一頁
尾頁

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者althon (嘿嘿...)時間16年前 (2009/12/31 22:24), 編輯資訊
0
0
0
內容預覽:
給您參考一下~ 你應該就懂了..... #include <stdio.h>. #include <stdlib.h>. int main(void). {. char *str="defg";. int value=3;. int *ptr;. ptr=&value;. printf("%d\n"
(還有75個字)

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者del680202 (HANA)時間16年前 (2009/12/31 21:27), 編輯資訊
0
0
0
內容預覽:
閒來沒事跑跑看. 我用dev-c去跑沒遇到警告 或許是版本不同吧. 你可以把str="b"; 改成str="bsff一堆亂七八糟的東西"; 去跑跑看. 這樣比較能看出當中的差異. cout<<*str; 他當做字元處裡 而不是字串 所以只會印出b. 但是 printf("*str=%s\n",str

推噓3(3推 0噓 2→)留言5則,0人參與, 最新作者tokyobabylon (paris)時間16年前 (2009/12/31 19:09), 編輯資訊
0
0
0
內容預覽:
剛又寫了一隻更小的程式.... #include <stdio.h>. #include <stdlib.h>. int main(void). {. char *str="defg";. int value=3;. int *ptr;. ptr=&value;. printf("%d\n",*pt
(還有30個字)

推噓5(5推 0噓 7→)留言12則,0人參與, 最新作者tokyobabylon (paris)時間16年前 (2009/12/31 18:22), 編輯資訊
0
0
0
內容預覽:
剛寫了這隻小程式. 發現字串指標的一些問題還是搞不太懂.... #include <stdio.h>. #include <stdlib.h> // 用system("pause")要include stdlib.h這個header. #include <assert.h> // 用assert()
(還有1014個字)
首頁
上一頁
1
下一頁
尾頁