+ 1

Memcpy

Is it better to use memcpy for string copies as opposed to strcpy or strncpy? Does memcpy have the same flaw?

19th Aug 2021, 8:03 AM
Edward Finkelstein
Edward Finkelstein - avatar
4 Respuestas
+ 1
Well, atleast I learned something. Thanks again Martin Taylor 🐨
20th Aug 2021, 6:10 PM
Edward Finkelstein
Edward Finkelstein - avatar
0
I mean when one tries to copy a bigger c-string into a smaller destination string, strcpy throws no error, the behavior is just undefined. In terms of speed i don’t see a noticable difference. https://code.sololearn.com/c2MyjO7kVt64/?ref=app
19th Aug 2021, 6:12 PM
Edward Finkelstein
Edward Finkelstein - avatar