C Program to Copy all elements of an array into Another array

This page has a C Program to Copy the elements of an array into Another array. It is clear that, this C program will Copy all the elements of an array into Another array. For example: If we enter 5 elements to an Array one by one as 35 78 43 12 46, then the program will Copy all Array elements from the 1st array to 2nd Array as 35 78 43 12 46. The below given C program will Copy all elements from one array into Another array. Kindly check out the program to Copy the elements of an array into Another array. The Problem to Copy the elements of an array into Another array can be asked as, 1). C Program to Copy all elements of an array into Another array

2). C program to copy all elements of one array to another

3). C program to copy all elements of an array to another array

4). C program to copy the contents of one array into another

5). C Program to Copy the elements of one array into Another array



Program to Copy all elements from one array to Another

#include<stdio.h>

int main() {

int array1[25], array2[25];

int i, j, n1;

printf("

Enter no of elements to 1st array :");

scanf("%d", &n1);

printf("



Enter the 1st Array elements one by one

");

for (i = 1; i<=n1; i++)

scanf("%d", &array1[i]);

for (i = 1; i<=n1; i++)

array2[i] = array1[i];

printf("

The Coppied Array elements in the 2nd Array :

");

for (i = 1; i<=n1; i++)

printf("

%d", array2[i]);

return(0);

} Sample Output: Enter no of elements to 1st array :5

Enter the 1st Array elements one by one

45 78 35 19 83

The Coppied Array elements in the 2nd Array :

45

78

35

19

83

Related Popular Posts: