pass by reference - In C++, can the caller of a function ensure its arguments won't be modified? -
pass by reference - In C++, can the caller of a function ensure its arguments won't be modified? -
in next c++ code:
int foo(int &x); /* function prototype */ main() { int i=5; foo(i); } suppose i'm unable alter foo() in way.
is there way, in main(), phone call foo() can't modify i?
give re-create of i. way.
int j = i; foo(j); c++ pass-by-reference
Comments
Post a Comment