Originally Posted by
oogabooga
Did you fix these lines yet?
Code:
// in add
(*q) -> back -> next;
// in fetch
(*q) -> front -> next;
If you changed your gcc invocation in your makefile by adding -Wall to CFLAGS like this
Code:
CFLAGS = -Wall -o a.out
then the compiler would point out those lines automatically. It will also notify you that something is wrong with your fetch routine's return. Nifty.
(And why would you call your output a.out in a makefile? Still, that's your business.)
Presumably in
add you want
Code:
(*q) -> back -> next = temp;
I can't comprehend what
fetch is attemting to do.
EDIT: I took another peek at fetch and I get it now. But you presumably want to free(temp) and return fetch_data whether or not it's the last node being removed.
you have been very helpful, thank you very much. I have fixed these things you have told me about and tried out that -Wall in my makefile, which is awesome btw, but I still have the same error. program will not run. one of the errors I finally got rid of that the -Wall command showed me was on line 71 (inside fetch) which i removed by changing
Code:
(*q) -> front -> next;
to
Code:
(*q) -> front = (*q) -> front -> next;
which I'm not really sure if that makes sense to an experienced programmer, but it seemed to work out in my head... and I also moved the free temp and return fetch data outside of the else statement, but that did not fix it either.