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

[C] Using recursion, make a function. This function should take two arguments (a

ID: 3685806 • Letter: #

Question

[C] Using recursion, make a function. This function should take two arguments (a pointer to the first node in a linked list and a name to find). It returns a zero if the name does not exist in the list and a one if the name does exist in the list.

provided code that calls function find():

printf("InEnter a name to find in the list (or 'quit' to exit) : "); name readToken (stdin); while (strcmp(name, "quit") ! =e) if ( find(head, name)) else printf( "Enter a name to find in the list (or 'quit' to exit) ) printf("The name %s exists in the list ", name); printf("The name %s does not exist in the list ", name); name readToken(stdin); =

Explanation / Answer

int find(const struct node *Node, const char *name)
{
if(Node == NULL)
return 0;
if(strcmp(Node->name, name) == 0)
return 1;
return find(Node->next, name);
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote