Void factors (int &n)

During the coding implementation of optimised approach why not the value of n is passed as reference (since n is changing)???

@Rishi-Raj-498676387415689 yes n is changing but only inside the function , if you pass it by reference than it will also get changed in main function but why you want to do that ? we pass something by reference if we want it changed inside main too. like we want to calculate sum we declared sum in main calculate it in function by passing by ref and display the changed in main.
hope its clear if yes dont forget to hit like and mark resolved :smile:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.