Line 75 it breaks. I believe while(temp!=NULL) works there but have no clue what to do after that. Maybe use bool. I also believe it will break in the delete section loop aswell. Any help? Yes I know I already posted this thank you.
> This is certainly wrong
It's not your fault that your function is used incorrectly.
`ap' should be a valid position, between 0 and size-1
> chang it to
that has a different meaning, now you are doing a search on the value passed.
> from imputing and deleting from location to imputing and deleting from the data alone.
>> I've really no idea what that could possibly mean
weird, your suggestion responded to that problem.
Sorry for the confusion I set up this to hold addresses and there value. I'm trying to store value to the next value so forth.
Also this works perfectly with it because the first num is ap then it's finding where to put it. The part I'm stuck on is linking 10 to 20 20 to 30 so forth in the code above. Basically getting rid of where to put the numbers.
Are you saying that you want to insert the items so that the list is sorted? I hope so, because that's what I'm going to talk about :)
There's a trick to inserting/deleting items in a singly linked list. Rather than using a pointer to the previous item, use a pointer to the pointer to the item. This will always point to top or the next pointer of an item. Now you can insert an item like this:
// Insert element into list. pp points to top, or a room's next pointer
I know I had this the other day but I figured out what I'm trying to do now. My for loop (line75)in the insert is breaking because of null as coder777 said. Can anyone help me there? I believe while(temp!=NULL) works but I'm lost after that.