will this correctly remove the user and their posts
int delete_user(const char *name, User **user_ptr_del) {
    // Delete user from list
    User *curr = *user_ptr_del;  // Variable to traverse the list
    User *temp = curr;   // Variable to hold the deleted user

    // Check for empty users list
    if (*user_ptr_del == NULL) {
        return 1;
    }

    // Remove the user from all friendlists, and clear user's list of friends
    remove_friends(name, user_ptr_del);

    // If there is 1 element in the list
    if (curr->next == NULL) {
        if (strcmp(curr->name, name) == 0) {
            *user_ptr_del = NULL;
            free_posts(temp->first_post);  // Free the memory of the posts of the deleted user
            if (temp != NULL) {
                free(temp);  // Free the memory of the user
            }
            return 0;
        } else {
            return 1;
        }
    }

    // If 1st element is to be removed
    if (strcmp(curr->name, name) == 0) {
        *user_ptr_del = curr->next;
        free_posts(temp->first_post);   // Free the memory of the posts of the deleted user
        if (temp != NULL) {
            free(temp);  // Free the memory of the user
        }
        return 0;
    }
        // Iterate through the users until the end of the list is reached,
    // or until the name of curr matches the name of the deleted user
    while (strcmp(curr->next->name, name) != 0 && curr->next != NULL) {
        curr = curr->next;
    }

    // If name does not exist
    if (curr->next == NULL) {
        return 1;
    }

    if (curr->next->next == NULL) {  // If the last user is to be removed
        temp = curr->next;
        curr->next = NULL;
    } else {
        temp = curr->next;  // If the user to be removed is in the middle of the list
        curr->next = curr->next->next;
    }

    free_posts(temp->first_post);  // Free the memory of the posts of the deleted user

    // Free the memory in temp
    if (temp != NULL) {
        free(temp);
        temp = NULL;
    }

    return 0;
}