num is passed by reference (the '&' symbol) in your test2 function.
This means that whatever changes are made to it inside the function
will remain after the function returns.
in your test2 function you are passing num by reference which means your function will now directly modify num. In test1 you are passing num by value so a copy of num is made which means the original num in your main function doesn't get touched.