Hi, so I made a program that implements doubly linked lists and have insert and delete functions. My delete functions which is suppose to delete at locations specified by an int typed index doesn't seem to be working.
here's that part of the code:
In general, 'variable' is a horrible name to use for any identifier.
Why does 'delete_after' take both a value and a location as arguments? Are you deleting by value or deleting by location? (Or both?!?)
Look at the first error you're receiving. The part it doesn't like is 'temp->variable', which means the member named 'variable' of the structure that 'temp' points to.
What type of structure does 'temp' point to?
What are the names of the members of that structure?
Is 'variable' one of them?
Yeah, your call to temp->variable should be temp->forward or temp->backward.
So much about this function is wrong ...
For example, why are you inserting a value in the delete function when the head is NULL? If the head is null you should simply return or throw an error. But calling a "delete" function and ending up with more than you started with is counter intuitive.
Wait, did you just copy "insert_after" and make a few adjustments?