strcpy
What's the point of the strcpy function?
Since we can do:
1 2 3
|
char*a = "abc";
char*b;
b = a;
|
And we can still modify a or b without affecting the other.
Why do we need strcpy?
And we can still modify a or b without affecting the other. |
No, you can't. Both a and b point to the same (read-only) array.
1 2 3 4 5 6
|
char a_modifiable_array[]="abc";
char *a=a_modifiable_array;
char *b=a;
std::cout <<a<<std::endl;
b[0]='A';
std::cout <<a<<std::endl;
|
Topic archived. No new replies allowed.