Step 3: Count elements of the doubly linked list
To count all elements of the doubly linked list, we will need a loop to traverse through the doubly linked list. We will let a pointer (i) of ListElem type to point to the pfirst then move the pointer to its next element and increase the number of item(t) one at a time by using a while loop until the end of the doubly linked list is reached.
//Count the number of items in the doubly linked list
This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages: