Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,884 questions

51,810 answers

573 users

How to use memmove() function to copy N bytes from source to destination in C

3 Answers

0 votes
#include <stdio.h>
#include <string.h>

int main(void)
{
	char s[] = "abc def ghi jkl";
	char s1[32];
  
	memmove(s1, s + 4, 3 * sizeof(char));
	puts(s);
	puts(s1);

    return 0;
}
  
    
/*
      
run:

abc def ghi jkl
def

*/

 



answered Jan 31, 2016 by avibootz
0 votes
#include <stdio.h>
#include <string.h>

int main(void)
{
	char s[] = "abc def ghi jkl";
  
	memmove(s, s + 4, 3 * sizeof(char));
	puts(s);

    return 0;
}
  
    
/*
      
run:

def def ghi jkl

*/

 



answered Jan 31, 2016 by avibootz
0 votes
#include <stdio.h>
#include <string.h>

int main(void)
{
	char s[256] = "Programming is complete fun";
  
	memmove(s + 24, s + 15, 12 * sizeof(char));
	puts(s);

    return 0;
}
  
    
/*
      
run:

Programming is complete complete fun

*/

 



answered Jan 31, 2016 by avibootz

Related questions

...