I am trying to pass array of vector by reference as defined here.
Here is how I am trying :
main()
{
vector<pair<int, int> > adj[V];
addEdge(adj, 1, 2, 30);
..................
printGraph(adj, V);
}
void addEdge(vector <pair<int, int> > (&adj) [5], int u,
int v, int wt)
{
adj[u].push_back(make_pair(v, wt));
adj[v].push_back(make_pair(u, wt));
}
But getting compile time errors? What did I miss?
On the followup note ,can I avoid specifying “5” as a array size in argument of function and keep it blank?