Thread: reagarding function's of <string.h> header file.

  1. #1
    Registered User
    Join Date
    Jul 2015
    Posts
    1

    reagarding function's of <string.h> header file.

    what's the difference between memcpy() and memmove() functions.???

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by kartik_07
    what's the difference between memcpy() and memmove() functions
    Refer to the C standard:
    Quote Originally Posted by C11 Clause 7.24.2.1
    Synopsis
    Code:
    #include <string.h>
    void *memcpy(void * restrict s1, const void * restrict s2, size_t n);
    Description
    The memcpy function copies n characters from the object pointed to by s2 into the object pointed to by s1. If copying takes place between objects that overlap, the behavior is undefined.

    Returns
    The memcpy function returns the value of s1.
    Quote Originally Posted by C11 Clause 7.24.2.2
    Synopsis
    Code:
    #include <string.h>
    void *memmove(void *s1, const void *s2, size_t n);
    Description
    The memmove function copies n characters from the object pointed to by s2 into the object pointed to by s1. Copying takes place as if the n characters from the object pointed to by s2 are first copied into a temporary array of n characters that does not overlap the objects pointed to by s1 and s2, and then the n characters from the temporary array are copied into the object pointed to by s1.

    Returns
    The memmove function returns the value of s1.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    If you had tried putting your question, exactly as it was stated, into a search engine, you might have found the following source: Question 11.25

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Header File and tolower issue with string
    By Inkinsarto in forum C++ Programming
    Replies: 23
    Last Post: 05-03-2013, 09:17 AM
  2. copy string to header file
    By jimmi666 in forum C++ Programming
    Replies: 2
    Last Post: 07-22-2009, 05:15 PM
  3. Replies: 30
    Last Post: 06-19-2006, 12:35 AM
  4. header file using a string in a class
    By linucksrox in forum C++ Programming
    Replies: 1
    Last Post: 04-21-2005, 03:06 PM
  5. String header file
    By Stan100 in forum C++ Programming
    Replies: 1
    Last Post: 03-01-2003, 01:26 PM