So I need to add two non empty linked lists. A created an add function which adds the two digits from my linked list and store the answer digit in a new linked list. So to accomplish this, I need to pass a double pointer as an argument in my function and I am passing either the "head" pointer or "tail" pointer of my answer linked list. However I am facing an error at line 27.
#Pointer Pain
33 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
*ans is a LinkedList*, since ans is a `LinkedList**~
(*ans)-> next
It's working as in it's compiling. It just means your code is valid, but incorrect.
Maybe dereferencing a null pointer somewhere
I guess that might be the issue.
No. You're using a pointer that you already deleted
Compile with debug symbols and it should show you where you're trying to access it at
Can you guys help me debug it?
looks like homework
Nah it’s just lc
Yeah its leet code.
yeah, I don't touch LC very intentionally. good luck
Debugging in LC sucks. You should probably run it on your own machine with GDB or some other debugger
Hmm... I made sure that I am not dereferencing a null pointer.
Problem is...... Idk how to use a debugger.

Wait, so it apparently says I am using a heap memory after freeing it? But I ain't freeing anything.
the os do it for you
But only after executing the program right?