討論串[問題] 大家好 關於字串反轉
共 4 篇文章
首頁
上一頁
1
下一頁
尾頁

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者loveme00835 (高髮箍)時間12年前 (2013/02/19 19:54), 編輯資訊
0
0
0
內容預覽:
在 C 語言中的字串定義是:. [n1256 §7.1.1/1]. A string is a contiguous sequence of characters terminated. by and including the first null character.. [n1256 §5.2.
(還有1757個字)

推噓0(0推 0噓 5→)留言5則,0人參與, 最新作者tobashi時間12年前 (2013/02/19 13:10), 編輯資訊
0
0
0
內容預覽:
試了一下發現將string size設5. 也就是String ret=(String)malloc(5). 居然也能成功??. 想請問 return ret[0]='\0' 這邊是將ret字串的開頭設為結尾??如此一來的話. 將12345 copy到 str中 str的分配是如何呢?. 是 \0

推噓7(7推 0噓 5→)留言12則,0人參與, 最新作者loveme00835 (高髮箍)時間12年前 (2013/02/18 17:50), 編輯資訊
0
0
0
內容預覽:
強烈建議初學者一定要學的語言feature: typedef. 首先先這樣:. typedef char* String;. 型態中如果有 * 出現, 表示它掌握著某種資源,. 1) 取得資源透過函式. 2) 釋放資源透過函式. 3) 任何存取也都透過函式. 這是一個規範, 確保你在更高的層面下編程
(還有1988個字)

推噓5(5推 0噓 8→)留言13則,0人參與, 最新作者tobashi時間12年前 (2013/02/18 12:35), 編輯資訊
0
0
0
內容預覽:
大家好 今天我想用函數來做字串反轉. #include <stdio.h>. #include <string.h>. void reverse(char* str). {. int i, j;. char temp;. for(i=0, j = strlen(str)-1; i<j; ++i, -
(還有213個字)
首頁
上一頁
1
下一頁
尾頁