Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1) Write the following function: int count_occurrences(struct node *list, int n)

ID: 3615099 • Letter: 1

Question

1) Write the following function: int count_occurrences(struct node *list, int n); The list parameter points to a linked list. The functionshould return the number of timesthat n appears in the list. Thenode structure is defined as (Alinked list consist of a chain ofstructures (called nodes), with each nodecontaining a pointer to the next node in the chain. The last nodein the list contains a null pointer. 1) Write the following function: int count_occurrences(struct node *list, int n); The list parameter points to a linked list. The functionshould return the number of timesthat n appears in the list. Thenode structure is defined as (Alinked list consist of a chain ofstructures (called nodes), with each nodecontaining a pointer to the next node in the chain. The last nodein the list contains a null pointer.

Explanation / Answer

Dear... intcount_occurrences(struct node *list, int n) {      int count=0;     while(list-next!=NULL)      {          if( list-value==n)             count++;        list=list-next;      }     returncount; } //end count_occurrences Hope this will help you...            intcount_occurrences(struct node *list, int n) {      int count=0;     while(list-next!=NULL)      {          if( list-value==n)             count++;        list=list-next;      }     returncount; } //end count_occurrences Hope this will help you...