 int delete_user(const char *name, User **user_ptr_del) {
 User *curr = *user_ptr_del;
        User *prev=NULL;
        //find the user
        while(curr!=NULL && strcmp(curr->name,name)!=0){
        prev=curr;
        curr=curr->next;
        }
        //remove the user
if (strcmp(curr->name,name)==0){
                prev->next=curr->next;

                //remove user from friend lists
                for(int i=0; i<MAX_FRIENDS;i++){

                        //find this user within friends' lists
                        User *f=curr->friends[i];
                        if(f!=NULL){
                                int j =0;
                                while(f->friends[j]!=NULL && strcmp(f->friends[j]->name,name)!=0){
                                j+=1;
                                }
                                if (strcmp(f->friends[j]->name,name)==0){
                                        //shift friends forward to get rid of this user
                                              while(j<MAX_FRIENDS-1){
                                              f->friends[j]=f->friends[j+1];
                                              j+=1;
                                              }

                                }

                        }
                }
                free(curr);
                return 0;
}
return 1;
 }
The code is supposed to remove the user with name from the list by setting pointer of the previous user before the user with name to the user after the user with name. It also need to delete all of the user with name from the users friends lists.