can you tell the diff between strcpy and memcpy?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mahendra23
    New Member
    • Jun 2007
    • 13

    can you tell the diff between strcpy and memcpy?

    Can u please tell me the difference between strcpy() and memcpy().
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    strcpy() copies bytes until it reaches a 0 byte.
    memcpy() copies memory based on the size argument regarless of contents.

    Comment

    • vpawizard
      New Member
      • Nov 2006
      • 66

      #3
      Hello,
      Another less obvious but often overlooked difference is,
      strcpy() - The strings may not overlap, and the destination string dest must be large enough to receive the copy.
      memcpy()- If copying takes place between objects that overlap, the behaviour is undefined.


      (P.S. - This problem ate up my whole day to figure it out)

      Comment

      Working...