On Sun, Feb 7, 2016 at 12:04 PM, Pavan Maddamsetti <pavan.maddamse...@gmail.com> wrote: > On Sun, Feb 7, 2016 at 3:01 PM, Pavan Maddamsetti > <pavan.maddamse...@gmail.com> wrote: >> Thanks for responding. At first, listp points at an uninitialized >> pointer-sized chunk of stack memory. Depending on the contents of ap >> and bp, it gets overwritten with either of those two pointers.
That may be what you want it to do, but that's not what the code does. I suggest you compile with -g and walk through it under the debugger, printing the value of listp before and after you think it's being changed. It may be easier to see if you initialize listp to NULL. You say it's set before being accessed, so initializing it should have no effect... Philip Guenther