how do i change the fuction below using pointer method to return back the value of x and y?
Code:void exchange(int x,int y) { int temp; temp = x; x = y; y = temp; return ; }
how do i change the fuction below using pointer method to return back the value of x and y?
Code:void exchange(int x,int y) { int temp; temp = x; x = y; y = temp; return ; }
You would change the parameters x and y such that they are pointers to int rather than int variables. Then you make the corresponding changes to the implementation of the function.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
HOPE YOU UNDERSTAND.......
By associating with wise people you will become wise yourself
It's fine to celebrate success but it is more important to heed the lessons of failure
We've got to put a lot of money into changing behavior
PC specifications- 512MB RAM, Windows XP sp3, 2.79 GHz pentium D.
IDE- Microsoft Visual Studio 2008 Express Edition
Here's a hint: When someone asks how to do something, don't do the whole thing for them. Tell them how, they can try it, and if they have problems, they can post their code and people can explain the process again.
Quzah.
Hope is the first step on the road to disappointment.