Heading
Hi,
I have not looked thoroughly in the code . But , in a quick look I spotted the following basic problem
nextPtr should be a pointer, you are creating an instance and copying the contents of the next structure. This is not efficient.
I will declare it as below
struct listNode *nextPtr; / pointer to next node */
Again , I will change the followingtypedef ListNode ListNodePtr;
typedef ListNode ListNodePtr;
to
typedef ListNode *ListNodePtr;
Try to restructure your code with this, and see how it goes. If not helping, I can have a detailed look in the evening.
1
solved Linked list program for student average