From f77fd6fb2dc65e4cef240197349b9aa755d45caf Mon Sep 17 00:00:00 2001 From: Ashwek Swamy <39827514+ashwek@users.noreply.github.com> Date: Sun, 17 Feb 2019 17:58:40 +0530 Subject: [PATCH] Update BFS.cpp Fixed issue #179 --- Graph/BFS.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Graph/BFS.cpp b/Graph/BFS.cpp index 798f869f9..cd8d22908 100644 --- a/Graph/BFS.cpp +++ b/Graph/BFS.cpp @@ -30,7 +30,7 @@ void graph::printgraph(){ } void graph::bfs(int s){ bool *visited = new bool[this->v+1]; - memset(visited,false,sizeof(visited)); + memset(visited,false,sizeof(bool)*(this->v+1)); visited[s]=true; list q; q.push_back(s); @@ -57,4 +57,4 @@ int main(){ //g.printgraph(); g.bfs(2); return 0; -} \ No newline at end of file +}