C/C++ Copy Array

For Indonesian version visit  my blog at http://fsharing.blogspot.com/2011/01/cara-mengcopy-array-di-cc.html

When we create array in C/C++, we can copy one array to another by looping every element array with for or while command. Besides using this command, we can use memcpy command (we can must include string.h at header of my code). This is example how to copy array with looping and copy memory method.

To compile this program, I use this command :

gcc main.c -o tes

This is output from this code :

array A
0  1  2  3  4  5  6  7  8  9
array B
0  1  2  3  4  5  6  7  8  9
array C
0  1  2  3  4  5  6  7  8  9

Thank Gary for your info 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.