Help needed to understand the right way of passing vectors, variables and arrays by reference to other functions
Problem Link - Problem - 580C - Codeforces
Solution reference on Codeforces - 79254858
I want to know what to use while passing an array or vector by reference in a function. By referring to other people’s solutions, I found that some solutions had vector<int> &edges
and some had vector<int> *edges
. Also, some people use int vis[]
or some use int &vis
.
I want to know which is the best passing by reference technique ?
Expecting positive response from all of you.
Also, any good coding practices from you will be welcome. Thanks in advance.