0

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
2
Contributors
2
Replies
10
Views
3 Years
Discussion Span
Last Post by nhrnjic6
0

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.

Edited by NathanOliver

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.