Binary Search Tree-Strange problem
I'm having a problem with my bst and I can't work out why. I've looked through so many pages of code but can't find a similar problem.
In my program, I originally got it to read a file of numbers and create a bst using those numbers. This didn't seem to be working so I changed it to allow the user to input one number at a time to be added to the tree. Now I realise why the original code wasn't working. When the user is inputting data, the program exits suddenly depending on the input! It generally allows me to input 4 or 5 data items, then exits.
eg.if the user inputs 2,1,4,3 then tries to input 5,it crashes.
I have absolutely no idea why because my code seems to be very similar to any I can find on the internet.
I assume the problem must be with the insert() function.
I've attached the .c,.h and main files but it's my first post so tell me if I haven't added them the right way
Any help would be much appreciated!