(Move to ...)
▼
Using a reference as a synonym
#include <iostream.h>
void main()
{ int n=44;
int& rn=n; // r is a synonym for n
cout << "n = " << n << ", rn = " << rn << endl;
--n;
cout << "n = " << n << ", rn = " << rn << endl;
rn *= 2;
cout << "n = " << n << ", rn = " << rn << endl;
}
No comments:
Post a Comment
‹
›
Home
View web version
No comments:
Post a Comment