What is the difference between memcpy and memmove?



What is the difference between memcpy and memmove?..

Answer / Jatin Girdhar

In C, 'memcpy()' copies a block of memory from one location to another, assuming both source and destination pointers point to valid memory regions that do not overlap. On the other hand, 'memmove()' can copy memory blocks even if their source and destination overlaps, ensuring correct results in this case.n`char src[5] = {'H', 'e', 'l', 'l', 'o'};nchar dest[5];nmemcpy(dest, src, 5); /* valid */nmemmove(src + 2, src, 3); /* safe if src and dest overlap */n"`

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

Is a pointer a kind of array?

1 Answers  


What are comments and how do you insert it in a C program?

1 Answers  


What is the difference between procedural and functional programming?

1 Answers  


What is the explanation for modular programming?

1 Answers  


Wt are the Buses in C Language

1 Answers   Infosys,


write a program to reverse the words in the sentence.NOTE:not reverse the entire string but just the occurance of each word

1 Answers   Sienna Ecad, Wipro,


is c language is a object oreinted language?

5 Answers   TCS,


Explain how can I prevent another program from modifying part of a file that I am modifying?

1 Answers  


write a c program to find the probability of random numbers between 1-1000

0 Answers   ADS,


what are the various memory handling mechanisms in C ?

4 Answers   HP,


Convert a distance from miles to kilometers .there are 5280 feets per mile,12 inches per foot .2.54 centimeters per inch and 100000centimeters per kilometer

0 Answers   TCS,


In this assignment you are asked to write a multithreaded program to find the duplicates in an array of 10 million integers. The integers are between -5000,000 to 5000,000 and are generated randomly. Use 10 threads, each thread works on 1000,000 integers. Compare the time needed to accomplish the task with single thread of execution program. Do not include the time to fill the array with integers in the execution time.

1 Answers  


Categories