C Programming Code Examples C > Arrays and Matrices Code Examples Program Code to copy array in C Program Code to copy array in C This program shall help you learn one of basics of arrays. Copying an array involves index-by-index copying. For this to work we shall know the length of array in advance, which we shall use in iteration. Another array of same length shall be required, to which the array will be copied. #include <stdio.h> int main() { int original[10] = {3, 8, 1, 5, 7, 9, 2, 4, 9, 0}; int copied[10]; int loop; for(loop = 0; loop < 10; loop++) { copied[loop] = original[loop]; } printf("original -> copied \n"); for(loop = 0; loop < 10; loop++) { printf(" %2d %2d\n", original[loop], copied[loop]); } return 0; } procedure copy_array(A, B) SET index to 1 FOR EACH value in A DO B[index] = A[index] INCREMENT index END FOR end procedure