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

Respuesta :

Answer:

The best head_ptr in the linked list is the node. A device connected to a network is called the node.

For example, if there is a network of five computers and two printers, there are eight nodes. Each has a network address and uniquely identifies.

Explanation:

Suppose there is a link list of function struct like this

void f ( struct node * head)

There is a pointer and can change the structure. But cannot change the variable head points. So consider the following code

struct node

{

int f1

struct node* next:

}

If the head has pointed at the head of the link list, then it can use the struct node*.