if we are simply writing vector name,its giving random result
Why do we need to put &(ampersand) when vector is passed as parameter in function
Hello Ketan, This means that the vector is passed as reference and if you made any change to that vector it will reflect in the overall code wherever you use that vector it value gets changed and if you don’t use ampersand then it means that the copy of that vector is passed and that is limited to that function only. The changes won’t reflect outside the function.
I hope it is clear to you. In case it is clear to you pls mark it as resolve and provide the rating as well as feedback so that we can improve ourselves.
In case there is still some confusion pls let me know, I will surely try to help you out.
Thanks
Happy Coding !!