Memcpy | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 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
2 Respostas
+ 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