Prime Factorisation of a number

In the function: vectorfactorize why the 2nd argument is passed by address?
It’s a vector and hence dynamic , then why pass by address??

vector is non-array, non-reference, and non-pointer - it is being passed by value,
and hence it will call copy-constructor. So, you must use vector& (preferably with const , if function isn’t modifying it) to pass it as a reference. vector would be passed by value in this.

1 Like

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.

1 Like

okay thanks sir for your help