strcpy vs. memcpy

后端 未结 9 849
梦如初夏
梦如初夏 2020-12-07 08:17

What is the difference between memcpy() and strcpy()? I tried to find it with the help of a program but both are giving the same output.

         


        
9条回答
  •  佛祖请我去吃肉
    2020-12-07 08:46

    • Behavior difference: strcpy stops when it encounters a NULL or '\0'
    • Performance difference: memcpy is usually more efficient than strcpy, which always scan the data it copies

提交回复
热议问题