#include #include using namespace std; struct str { int f1; int f2; }; void f(str copy, str *p, const str& r); int main() { str a1 = {10, 20}; str a2 = {30, 40}; str a3 = {50, 60}; f(a1, &a2, a3); cout << "a1.f1 == " << a1.f1 << "\n" << "a2.f1 == " << a2.f1 << "\n" << "a3.f1 == " << a3.f1 << "\n"; return EXIT_SUCCESS; } void f(str copy, str *p, const str& r) { ++copy.f1; //has no effect on a1.f1; means copy.f1 = copy.f1 + 1 ++p->f1; //adds 1 to a2.f1; means p->f1 = p->f1 + 1 //++r.f1; //won't compile }