Monday 5 December 2016

Assigning one array to another array c++

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);

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...