64.0k views
1 vote
Suppose that f is a function with a prototype like this: void f(________ head_ptr); // Precondition: head_ptr is a head pointer for a linked list. // Postcondition: The function f has done some computation with // the linked list, but the list itself is unchanged. What is the best data type for head_ptr in this function?

User Imtheman
by
7.5k points

1 Answer

4 votes

Answer:

node*

Step-by-step explanation:

The argument 'head_ptr' is the head-pointer for the following linked list so the data type of the following argument 'head_ptr' is 'node*' in the method 'f()' because the following method 'f()' computed the linked list, but perhaps the list itself remains unaffected.

A linked list is the DS type in which that component would be a different entity. Such component of the following list is called as a node that consists of two elements

User Daniyelp
by
7.8k points