strcpy vs. memcpy

后端 未结 9 833
梦如初夏
梦如初夏 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:28

    The main difference is that memcpy() always copies the exact number of bytes you specify; strcpy(), on the other hand, will copy until it reads a NUL (aka 0) byte, and then stop after that.

提交回复
热议问题