The Null Pointer Figure 5.3 illustrates a linked list with a head pointer and on
ID: 3859412 • Letter: T
Question
The Null Pointer Figure 5.3 illustrates a linked list with a head pointer and one new feature. Look at the link of the final node. Instead of a pointer, we have written the word NULL The word NULL indicates the null pointer, which is a special C+constant. You can use the null pointer for any pointer value that has no place to point. There are two common situations where the null pointer is used: .Use the null pointer for the link field of the final node of a linked list. When a linked list does not yet have any nodes, use the null pointer for the value of the head pointer and tail pointer. Such a list is called the empty list. In a program, the null pointer may be written as NULL, which is defined in the Standard Library facilityExplanation / Answer
head_ptr is a pointer itself . In Figure 5.3, it shows that head_ptr is a pointer which points to first node of the linked list. i.e. it stores the address (which is in hexadecimal) of the first node of the linked list.
So precisely we can say that head_ptr data type is node* where node is one node(struct) of the linked list.
data type of *head_ptr is the data type of value whose address is stored in head_ptr . . . head_ptr contains the address of node, So data type of *head_ptr is node.
head_ptr-> data() gives the data stored in the node whose address is stored in head_ptr, so data type of
head_ptr->data() will be data type of data , Say, -4.8 is float, so data type of head_ptr->data() is float.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.