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

//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<stdio.h>
#include<conio.h>
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();
}

Share this

Related Posts

:)
:(
hihi
:-)
:D
=D
:-d
;(
;-(
@-)
:P
:o
:>)
(o)
:p
:-?
(p)
:-s
(m)
8-)
:-t
:-b
b-(
:-#
=p~
$-)
(y)
(f)
x-)
(k)
(h)
cheer