Assigning one array to another array c++
arrays, c++
Solution
It isn't copying the array; it's turning it to a pointer. If you modify it, you'll see for yourself:
void f(int x[]) { x[0]=7; }
...
int tst[] = {1,2,3};
f(tst); // tst[0] now equals 7
If you need to copy an array, use `std::copy`:
int a1[] = {1,2,3};
int a2[3];
std::copy(std::begin(a1), std::end(a1), std::begin(a2));
If you find yourself doing that, you might want to use an `std::array`.
Problem
Hello I am beginner in c++ , can someone explain to me this ``` char a[]="Hello"; char b[]=a; // is not legal ``` whereas, ``` char a[]="Hello"; char* b=a; // is legal ``` If a array cannot be copied or assigned to another array , why is it so that it is possible to be passed as a parameter , where a copy of the value passed is always made in the method ``` void copy(char[] a){....} char[] a="Hello"; copy(a); ```