How default assignment operator works in struct?

Posted by skydoor on Stack Overflow See other posts from Stack Overflow or by skydoor
Published on 2010-03-20T17:42:05Z Indexed on 2010/03/20 17:51 UTC
Read the original article Hit count: 326

Filed under:

Suppose I have a structure in C++ containing a name and a number, e.g.

struct person {

char name[20];

int ssn;

};

Suppose I declare two person variables:

person a;

person b;

where a.name = "George", a.ssn = 1, and b.name = "Fred" and b.ssn = 2.

Suppose later in the code

a = b;

printf("%s %d\n",a.name, a.ssn);

© Stack Overflow or respective owner

Related posts about c++