Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library
← Back to context

Comment by koolba

15 hours ago

> The second one is absolutely trivial if you've ever read K&R (even if you're not allowed to just call strcpy())

The naive approach’s assumes you can iterate over the first string until it terminates.

It’s a bit trickier if you do not assume the memory regions cannot overlap.

See memcpy vs memmove: https://man7.org/linux/man-pages/man3/memmove.3.html

0 comments

koolba

Reply

No comments yet

Contribute on Hacker News ↗

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities