SW006014 Microchip Technology, SW006014 Datasheet - Page 122

C COMPILER MPLAB FOR PIC24 MCU

SW006014

Manufacturer Part Number
SW006014
Description
C COMPILER MPLAB FOR PIC24 MCU
Manufacturer
Microchip Technology
Type
MPLAB® C Compilerr
Series
PIC24r
Datasheet

Specifications of SW006014

Supported Families
PIC24
Core Architecture
PIC
Kit Contents
Software And Docs
Mcu Supported Families
PIC24
Tool Function
Compiler
Tool Type
Compiler
Processor Series
PIC24
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
PIC24
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
DS51456E-page 118
memmove
Description:
Include:
Prototype:
Arguments:
Return Value:
Remarks:
Example:
Copies n characters of the source buffer into the destination buffer,
even if the regions overlap.
<string.h>
void *memmove(void *s1, const void *s2, size_t n);
s1
s2
n
Returns a pointer to the destination buffer
If the buffers overlap, the effect is as if the characters are read first from
s2 then written to s1 so the buffer is not corrupted.
#include <string.h> /* for memmove */
#include <stdio.h>
int main(void)
{
}
Output:
buf1 : When time marches on
buf2 : Where is the time?
buf3 : Why?
buf1 after memmove of 6 chars of buf2:
buf1 after memmove of 5 chars of buf3:
char buf1[50] = "When time marches on";
char buf2[50] = "Where is the time?";
char buf3[50] = "Why?";
printf("buf1 : %s\n", buf1);
printf("buf2 : %s\n", buf2);
printf("buf3 : %s\n\n", buf3);
memmove(buf1, buf2, 6);
printf("buf1 after memmove of 6 chars of "
printf("\n");
memmove(buf1, buf3, 5);
printf("buf1 after memmove of 5 chars of "
Where ime marches on
Why?
"buf2: \n\t%s\n", buf1);
"buf3: \n\t%s\n", buf1);
buffer to copy characters to (destination)
buffer to copy characters from (source)
number of characters to copy from s2 to s1
/* for printf
© 2008 Microchip Technology Inc.
*/

Related parts for SW006014