Code to copy an array to another array in C++
#include <bits/stdc++.h>
using namespace std;
int a[100000], b[10000];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin >> n;
for (int i = 1; i <= n; i++)
{
cin >> a[i];
}
cout << "Before Copy\n";
for (int i = 0; i < n; i++)
{
cout << a[i] << " ";
}
cout << "\n";
for (int i = 0; i < n; i++)
{
cout << b[i] << " ";
}
cout << "\n";
for (int i = 0; i < n; i++)
{
b[i] = a[i];
}
cout << "After copy\n";
for (int i = 0; i < n; i++)
{
cout << a[i] << " ";
}
cout << "\n";
for (int i = 0; i < n; i++)
{
cout << b[i] << " ";
}
}