title: expression must have class type in C++ vectors
body: <p>My program gives an incorrect output for test cases other than 1. I figured out that I should change the values of every element in <code>vec</code> and visited to 0. I can do it for visited but I get an error for <code>vec</code>.</p>
  
  <pre><code>#include &lt;bits/stdc++.h&gt;
  using namespace std;
  vector &lt;int&gt; vec[100001];
  int visited[100001];
  
  void dfs(int node)
  {
      visited[node] = 1;
      for (int child : vec[node])
      {
          if (!visited[child])
              dfs(child);
      }
  }
  
  int main()
  {
      ios_base::sync_with_stdio(0);
      cin.tie(0);
      int t;
      cin &gt;&gt; t;
      while (t--)
      {
          int n, e, a, b;
          cin &gt;&gt; n;
          cin &gt;&gt; e;
          for (int i = 0; i &lt; e; ++i)
          {
              cin &gt;&gt; a &gt;&gt; b;
              vec[a].push_back(b);
              vec[b].push_back(a);
          }
          long long c = 0;
          for (int i = 0; i &lt; n; ++i)
          {
              if (!visited[i])
              {
                  dfs(i);
                  ++c;
              }
          }
          cout &lt;&lt; c &lt;&lt; '\n';
          memset(visited, 0, sizeof(visited));
          fill(vec.begin(), vec.end(), 0);
      }
  }
  </code></pre>
  
  <p>I used <code>memset()</code> for visited and <code>fill()</code> for vec. How to resolve this issue?
  Input:</p>
  
  <pre><code>2
  4
  2
  0 1
  0 2
  8
  0
  </code></pre>
  
  <p>Expected output:</p>
  
  <pre><code>2
  8
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>CC.cpp: In function 'int main()':
  CC.cpp:47:18: error: request for member 'begin' in 'vec', which is of non-class type 'std::vector&lt;int&gt; [100001]'
           fill(vec.begin(), vec.end(), 0);
                    ^
  CC.cpp:47:31: error: request for member 'end' in 'vec', which is of non-class type 'std::vector&lt;int&gt; [100001]'
           fill(vec.begin(), vec.end(), 0);
  </code></pre>
  
  <p>If I remove the line with <code>fill()</code>:
  Output:</p>
  
  <pre><code>2
  6
  </code></pre>
  
  <p>The program is for finding the number of connected components in a graph.</p>