Hi guys I'm wondering whats the differences between these pieces of code in one I'm using the * to pass by ref a and in the other I'm using & to pass by ref yet I still get the same result,whats the difference and why are the results the same?
they both do the same , pass by reference and pointer , as you can see pass by value does not do much out of its scope. the difference is that you wont be able to change the address of the reference , the pointer you get the address but you can change it , to access its data you use the * operator. Use & or * depend on your cases. Both are valid.