title: Why am I getting array bound is not an integer constant before ‘]’ token even though declared the size globally?
body: <p>I was trying topological sorting but I got error with the declaration of array.I had attached the part in which i got error.
  If I replace the n in visited array with the value 6 then the algorithm work fine .
  I do not understand why this is happening?
  Here is the Code in which I was getting error: 
  <a href="https://ideone.com/b2fUfG" rel="nofollow noreferrer">Code On Ideone</a></p>
  
  <pre><code>#include&lt;iostream&gt;
  #include&lt;vector&gt;
  using namespace std;
  
  int n=6;
  int visited[n]={0};
  int main()
  {
      cout&lt;&lt;visited[0];
  }
  </code></pre>