dimanche 28 mars 2021

Getting "Segmentation fault" in the following code

While learning the implementation of Graphs, i came across thi code on GFG. When I tried to compile it on local compiler i got this error.

    for( int i = 0 ; i < v ; ++i){
        cout<<"the adjacency list for vertex "<<v;
        for( auto j : adj[i]){
            cout<<"->"<<j;
        }
        cout<<endl ;
    }
}

Aucun commentaire:

Enregistrer un commentaire