- //Title : Copy Array Elements from one array to another
- //a - Source Array ( elements will be copied from this array)
- //b - Destination array ( elements copied into this array)
- //---------------------------------------------------------------------
- #include
- #include
- void main()
- {
- int a[30],b[30],i,n;
- // Element of an array 'a' will be copied into array 'b'
- printf("\n Enter no of elements :");
- scanf("%d",&n);
- /* Accepting values into Array a*/
- printf("\n Enter the values :");
- for(i = 0 ; i < n ; i++)
- scanf("%d",&a[i]);
- /* Copying data from array 'a' to array 'b */
- for(i = 0 ;i < n ; i++)
- b[i]=a[i];
- /* printing of all elements of array */
- printf("the copied array is :");
- for(i=0;i < n;i++)
- printf("\nb[%d]=%d",i,b[i]);
- getch();
- }
About Me
- Amit Singh Thakur
- Raipur, Chhattisgarh, India
- Hi , I am Amit Thakur. I have worked as a QA Engineer for two years and as a Java Developer for one year in NIHILENT TECHNOLOGIES PVT. LTD., Pune.Currently I am working as DEAN (Research & Development) in Bhilai Institute of Technology, Raipur.
Monday, September 2, 2013
copy all elements of an array into another array in C
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment