Why does my vector need a constant value?

  adjacency-list, c++, graph, vector

I’m trying to make an adjacency list graph implementation using vectors. In my vector declaration, I keep getting an error of "expression must have a constant value." I don’t understand why I get this error, as I thought that vectors were already dynamic arrays and this wouldn’t be a problem.

int nodes = 5;

vector<int> adjacencyList[nodes];

Source: Windows Questions C++

LEAVE A COMMENT