![]() |
link list
Hey guys my assignment is to use link list and take numbers from a infile and print out and sort the numbers. My code is below. I have done everything except I am not sure why Its printing out a zero before my numbers...well I might know but I don't know how not to print it out. Any advice?
-----------------------------------------whole code----------------------------------------------- Code:
#include <stdio.h> |
Re: link list
Do you expect a helpful reply with not much info provided apart from the lines and lines of code.
Refer to my post here |
Re: link list
Sorry thought I gave enough there. Alright I will explain more what I am trying to do and what I have done. :)
Alright, first my goal was to take some numbers from an infile or inputfile (any numbers). They happend to be 8,0,4,9...in the input file. Then I scanf the infile for numbers below with a fscanf and then they are passed up to some helper function which I will explain If I need to. Below is the scanning part. Code:
/* insertion sort */nuke@nuke:~$ ./a.out infile outfile Adding node with data value 8 Adding node with data value 4 Adding node with data value 0 Adding node with data value 9 Total number of nodes added = 4 Sorted list ----- Val: 0 Val: 0 Val: 4 Val: 8 Val: 9 nuke@nuke:~$ So I am not sure how I would get rid of that zero...the first one because there is a zero in my infile. :) :) :) :) :) :) |
Re: link list
sorry for all the smilies...didn't realize they posted at the bottom.
|
Re: link list
You list contains a blank node at the start. Check the InsertNodeAfter
Also you are not upadting the start in the function but just passing and returning. |
| All times are GMT +5.5. The time now is 09:42. |