implementation of "pass by reference" in c and cpp