#include "stdafx.h" #include using namespace std; struct Rect { int top; int bottom; // define left/right too }; int calculatePerimeter(Rect r) { } void growByXPercent(Rect *rp, double x) { rp->bottom *= 1 + x; } void growByXPercent_(Rect &rp, double x) { rp.bottom *= 1 + x; } int main() { Rect rect; rect.top = 100; rect.bottom = 120; int p = calculatePerimeter(rect); growByXPercent(&rect, .2); growByXPercent_(rect, .2); // C++ version call by ref return 0; }