struct assignment operator on arrays
Posted
by
Django fan
on Stack Overflow
See other posts from Stack Overflow
or by Django fan
Published on 2012-04-05T14:56:15Z
Indexed on
2012/04/05
23:28 UTC
Read the original article
Hit count: 388
Suppose I defined a structure like this:
struct person
{
char name [10];
int age;
};
and declared two person variables:
person Bob;
person John;
where Bob.name = "Bob", Bob.age = 30 and John.name = "John",John.age = 25. and I called
Bob = John;
struct person would do a Memberwise assignment and assign Johns's member values to Bob's.
But arrays can't assign to arrays, so how does the assignment of the "name" array work?
© Stack Overflow or respective owner