[討論] memcpy, memmove

看板b04902xxx作者 (johnchen902)時間8年前 (2015/10/17 17:16), 編輯推噓4(401)
留言5則, 4人參與, 最新討論串1/1
在 <string.h> 裡有兩個函式,memcpy 和 memmove void *memcpy (void *destination, const void *source, size_t num); void *memmove(void *destination, const void *source, size_t num); 兩者的功能都是從 source 開始,複製 num 個位元組到 destination 。 兩者的回傳值都是 destination 。 兩者的差異在於 memcpy 不允許 source 和 destination 重疊, memmove 允許 source 和 destination 重疊。 為什麼不用迴圈就好了呢?因為 memcpy 和 memmove 很可能比手暴迴圈快。 如果你 Judge Girl 46. Play with words 一直 TLE 的話,不妨試試。 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.112.16.137 ※ 文章網址: https://www.ptt.cc/bbs/b04902xxx/M.1445073373.A.929.html

10/17 21:40, , 1F
藏在這…獎勵有逛ptt B04版的人XD
10/17 21:40, 1F

10/17 22:08, , 2F
<(_ _)>先拜再說
10/17 22:08, 2F

10/18 14:16, , 3F
先拜<(_ _)>
10/18 14:16, 3F

10/18 19:26, , 4F
還是TLE了......
10/18 19:26, 4F

01/11 21:39, , 5F
酷耶 長知識
01/11 21:39, 5F
文章代碼(AID): #1M8X7Taf (b04902xxx)