I have a undirected graph (may be disconnected graph). I need to find Number of unreachable nodes for a given node.
#include<bits/stdc++.h>
using namespace std;
vector<int> graph[1000];
bool visited[1000];
int count=0;
void dfs(int s)
{
  count=count+1;
  visited[s]=true;
  for(int i=0;i<graph[s].size();i++)
    if(visited[graph[s][i]]==false)
      dfs(i);
}
int main()
{
  int n,m;
  cin>>n>>m;
  int i;
  for(i=0;i<m;i++)
  {
    int x,y; 
    cin>>x>>y;
    graph[x].push_back(y);
    graph[y].push_back(x);
  }
  int k;
  cin>>k;
  dfs(k);
  cout<<n-count;
}
Initially the graph has n nodes. After DFS process, for the particular node k ,dfs(k) finds number of nodes connected with k. So the unreachable nodes can be calculated by n-count.
But this codes shows an error that says reference to 'count' is ambiguous. What is the problem? Did I make any mistake in DFS recursive method?
 
    