If I have this
struct S
{
int arr[5];
};
and I do this:
S s1,s2;
....
s1 = s2;
what happens?
Normally, array assignments aren't possible/allowed. If I do s1.arr =
s2.arr I get a compiler error. If I do s1 = s2 it compiles fine. And it
even seems like the array is getting copied, not just the pointer to the
start of the array, at least with g++.
Is there any difference in semantics here betweeen C and C++?
/David
struct S
{
int arr[5];
};
and I do this:
S s1,s2;
....
s1 = s2;
what happens?
Normally, array assignments aren't possible/allowed. If I do s1.arr =
s2.arr I get a compiler error. If I do s1 = s2 it compiles fine. And it
even seems like the array is getting copied, not just the pointer to the
start of the array, at least with g++.
Is there any difference in semantics here betweeen C and C++?
/David
Comment