C Program to Copy Array Elements into Other Array

Write a program to copy of one array into second array for given data elements.



Source Code
#include<stdio.h>

int main()
{
    int copy[5], paste[5], i;
    
    printf("Enter 5 array elements to copy\n");
    /* Input marks of 10 students */
    for(i=0; i<5; i++)
        scanf("%d", ©[i]);

    /* Logic to copy array elements from first into second */
    for(i=0; i<5; i++)
    {
        paste[i] = copy[i];
    }

    /* Print copied elements */
    printf("\nAfter copy second array becomes\n");
    for(i=0; i<5; i++)
        printf("%d ", paste[i]);

    return 0;
}
Output
Enter 5 array elements to copy
45 75 67 59 124

After copy second array becomes
45 75 67 59 124





"Coding Hub - Learn to code" app now available on Google Play Store