C - String Manipulation Functions, memmove
Tutorials Point


  Learning C
  C Function References
  C Useful Resources
  Selected Reading

Copyright © 2014 by tutorialspoint



  Home     References     About TP     Advertising  

C - memmove function

previous

Synopsis:

#include <stdio.h>

void* memmove(void* s, const void* ct, int n); 

Description:

Copies n characters from ct to s and returns s. s will not be corrupted if objects overlap.

Return Value

The memmove function returns s after moving n characters.

Example

#include <stdio.h>

int main() {
  static char buf [] = "This is line 1 \n"
                       "This is line 2 \n"
                       "This is line 3 \n";

  printf ("buf before = %s\n", buf);
  memmove (&buf [0], &buf [16], 32);
  printf ("buf after = %s\n", buf);
  return 0;
}

It will proiduce following result:

buf before = This is line 1
This is line 2
This is line 3

buf after = This is line 2
This is line 3
This is line 3


previous Printer Friendly

Advertisements


  

Advertisements



Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements