- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
memmove() function in C/C++
The function memmove() is used to move the whole memory block from one position to another. One is source and another is destination pointed by the pointer. This is declared in “string.h” header file in C language.
Here is the syntax of memmove() in C language,
void *memmove(void *dest_str, const void *src_str, size_t number)
Here,
dest_str − Pointer to the destination array.
src_str − Pointer to the source array.
number − The number of bytes to be copied from source to destination.
Here is an example of memmove() in C language,
Example
#include <stdio.h> #include <string.h> int main () { char a[] = "Firststring"; const char b[] = "Secondstring"; memmove(a, b, 9); printf("New arrays : %s\t%s", a, b); return 0; }
Output
New arrays : SecondstrngSecondstring
In the above program, two char type arrays are initialized and memmove() function is copying the source string ‘b’ to the destination string ‘a’.
char a[] = "Firststring"; const char b[] = "Secondstring"; memmove(a, b, 9);
- Related Articles
- Write your own memcpy() and memmove() in C++
- iswlower() function in C/C++
- towupper() function in C/C++
- iswdigit() function in C/C++
- ctime() Function in C/C++
- mbrtowc() function in C/C++
- wcspbrk() function in C/C++
- Power Function in C/C++
- Rename function in C/C++
- Remove function in C/C++
- ldexp() function in C/C++
- wcstoll() function in C/C++
- c16rtomb() function in C/C++?
- c32rtomb() function in C/C++?
- iswblank() function in C/C++

Advertisements