Friday 12 January 2018

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

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...