-->

Tuesday, May 20, 2025

C program to copy one array element to another | Array examples

Array programs in C

C program to copy one array elements to another 

/* program to copy one array element to another
*/

#include<stdio.h>
int main()
{
int a[5];
int b[5];
int i;
for(i=0;i<=4;i++)
{
printf("enter elment for %d location",i+1);
scanf("%d",&a[i]);
}
for(i=0;i<=4;i++)
{
b[i]=a[i];
}
printf("the copied elements are:\n");
for(i=0;i<=4;i++)
{
printf(" %d ",b[i]);
}
return 0;
}


Output:-

c program to copy elements to another array



No comments:

Post a Comment