program works fine until I call print_List function :

void print_List() {



       Vagon *kondukter = head;

            while(kondukter != 0) {

                cout << kondukter->num<<" ";
                kondukter = kondukter->p_next_num;

             }

                cout << kondukter->num<<" ";
      }





  and that it opens some some new boxs that says : win checking for solutions. I used debugger and it says its a segmentation fault, but dont know how to fix it. Please help, thanks

Recommended Answers

All 2 Replies

Get rid of line 14. On the last time through your loop you will reach the end node which shouold be null. Then line 14 tries to access it and since it is null it will throw a fault.

thank you :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.