[問題] 如何回傳字串指標中的某個記憶體位址?
http://rafb.net/p/FXzfKy46.html
這是C++ primer plus 第八章的練習題第六題
題目的一部分是要求要傳入一個char指標陣列給函式,
然後要回傳其中最長字串的記憶體位址。
我卡在回傳記憶體位址的地方,不知道該怎麼修改才對。
請板友們幫我看看,謝謝!
--------------------------------------
我把部分的題目貼上來好了
The program also should include a specialization
that takes an array of pointers-to-char as an
argument and the number of pointers as a second
argument and which returns the address of the
longest string. If there are more than one string
having the longest length, the function returns the
address of the first one tied for longest.
Test the specialization with an array of 5 string
pointers.
我想問的就是上面這件事情..
P.S. C++真不好學啊...雖然學過C..
--
我以為遠方 會有新的風景
卻在每一個異地 流浪回望著記憶
"For the way I live" by Tizzy Bac
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 123.194.100.216
推
03/23 00:25, , 1F
03/23 00:25, 1F
→
03/23 00:27, , 2F
03/23 00:27, 2F
→
03/23 00:28, , 3F
03/23 00:28, 3F
→
03/23 00:28, , 4F
03/23 00:28, 4F
→
03/23 00:28, , 5F
03/23 00:28, 5F
推
03/23 00:33, , 6F
03/23 00:33, 6F
推
03/23 00:35, , 7F
03/23 00:35, 7F
※ 編輯: zptdaniel 來自: 123.194.100.216 (03/23 00:37)
→
03/23 00:38, , 8F
03/23 00:38, 8F
→
03/23 00:38, , 9F
03/23 00:38, 9F
推
03/23 00:45, , 10F
03/23 00:45, 10F
→
03/23 00:50, , 11F
03/23 00:50, 11F
→
03/23 11:00, , 12F
03/23 11:00, 12F
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章