You are here:

C/Is memcpy faster than manual copy

Advertisement


Question
-------------------------
Followup To
Question -
Hi,

Is memcpy() function faster than manual array to array copy. ALso I wanted to know if I have to in real time copy one array into another is memcpy good enough?

Thanks,
Ajay
Answer -
In array to array copy, you will have to copy element by element.
So, obviously memcpy will be much faster.

I don't know what you mean by "real time copy"?

-Narendra


Thanks Narendra,

Can you tell me how much faster will it be ? Say for example I have an array of 40000 float points. If possible can you send me the code for memcpy for the problem I just mentioned.

Thanks,
Ajay

Answer
>Can you tell me how much faster will it be ?
It is relative.....depends on the processor you are using and the OS/compiler also!

Regarding the code, I suggest you to write it yourself and test. It will be a trivial code for which I don't think you will need help.

-ssnkumar

C

All Answers


Answers by Expert:


Ask Experts

Volunteer


Narendra

Expertise

I can answer questions in C related to programming, data structures, pointers and file manipulation. I use Solaris for doing C code and if you have questions related to C programming on Solaris, I will be able to help better.

Experience

6.5

Organizations belong to
Sun Microsystems

Awards and Honors
Brain Bench Certified Expert C programmer.
Advanced System Software Certified

©2012 About.com, a part of The New York Times Company. All rights reserved.