Copy one Array into another Array by R4R Team

Array:
Array is the collection of different values having same data type.
-We have a integer Array that having all integer values.
-Character array is known as String.

program-

#include < stdio.h>
int main()
{
int a[5],b[5];
int i;
printf("Enter 5 number in first array\n");
//input in first array
for(i=0;i< 5;i++){
scanf("%d",&a[i]);
}
//copy one array into another
for(i=0;i< 5;i++)
{
b[i]=a[i];
}
printf("Second array is\n");
for(i=0;i< 5;i++)
printf("%d,",b[i]);
}


output-

Enter 5 number in first array
1 2 3 4 5
Second array is
1 2 3 4 5

-In this program, we take a input of 5 numbers in first array.
-then try to copy the first array element into the second array.
-then we print the second array.




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!