int delete_user(const char *name, User **user_ptr_del) {
    // check whether the user with this name exist or not
    User *user = find_user(name, *user_ptr_del);
    if (user == NULL) {
        return 1;
    }

    // unlink this user with others
    User *curr = *user_ptr_del;
    if (strcmp(curr->name, name) == 0) {
        curr->next = NULL;
    } else {
        while (curr->next != NULL) {
            if (strcmp(curr->next->name, name) == 0) {
                curr->next = curr->next->next;
            }
            curr = curr->next;
        }
    }

    // remove this user from any friend's lists
    for (int i = 0; i < MAX_FRIENDS; i++) {
        if (user->friends[i] != NULL) {
            for (int j = 0; j < MAX_FRIENDS; j++) {
                if (user->friends[i]->friends[j] == user) {
                    user->friends[i]->friends[j] = NULL;
                }
            }
        }
    }
    
    // free all heap memory that was allocated
    Post *post = user->first_post;
    while (post != NULL) {
        free(post->contents);
        post = post->next;
        free(post);
    }
    free(user);

    return 0;
}
* From the list pointed to by *user_ptr_del, delete the user
 * with the given name.
 * Remove the deleted user from any lists of friends.
 *
 * Return:
 *   - 0 on success.
 *   - 1 if a user with this name does not exist.