 int delete_user(const char *name, User **user_ptr_del) {
    User *prev = NULL;
    User *curr = *user_ptr_del;
    while (curr != NULL) {
        // remove user from friend's list
        if (strcmp(curr->name, name) == 0) {
            // remove current user from all friends
            int i, j;
            for (i = 0; i < MAX_FRIENDS; i++) {
                User *friend = curr->friends[i];
                if (!friend) continue;
                for (j = 0; j < MAX_FRIENDS; j++) {
                    if (friend->friends[j] == curr) {
                        // move all friends after current to the left
                        int k;
                        for (k = j; k < MAX_FRIENDS - 1; k++) {
                            friend->friends[k] = friend->friends[k + 1];
                        }
                        // clear the last friend
                        friend->friends[MAX_FRIENDS - 1] = NULL;
                        break;
                    }
                }
            }
    
            // remove current user from linked list
            if (prev == NULL) {
                *user_ptr_del = curr->next;
            } else {
                prev->next = curr->next;
            }

            // free memory of post
            Post *post = curr->first_post;
            while (post != NULL) {
                Post *temp = post->next;
                free(post->contents);
                free(post);
                post = temp;
            }
            free(curr);

            return 0;
        }
        prev = curr;
        curr = curr->next;
    }

    return 1;
}
It must remove the user from the list of users
It must remove the user from all user's friends lists.
It must remove the user's posts from all user's posts lists.