Question: In the following function, why cursor has been declared as a const variable? What happena if you change it to a non - conat variable?

In the following function, why cursor has been declared as a const variable?
What happena if you change it to a non-conat variable?
s121._?-
t list_length (const node* head_ptr)
// Precondition: head ptr is the hoad polinter of a linked Ist.
// Postcondition: The value returnod is the number of nodes in the //11 inked list.
1
canst fiode* cursar;
si2e_t answor:
ansusr =8;
for (cursor = head_ptr; cursor I- NuLL; cursor = cursor ->1ink(3)
+4arswer:
retara answer:
adf
In the following function, why cursor has been

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!