which pointer at which line isn't allocated
int delete_user(const char *name, User **user_ptr_del) {
    User *head = *user_ptr_del;
    User *target = find_user(name, head);
    if (target == NULL) {
        return 1;
    }

    //  delete friends
    while (head != NULL) {
        for (int i = 0; i < MAX_FRIENDS; i++) {
            if (head->friends[i] == NULL) {
                break;
            }
            if (strcmp(head->friends[i]->name, name) == 0) {
                head->friends[i] = NULL;
                //shift other friends to avoid NULL in between friends
                for (int j = i - 1; j < MAX_FRIENDS - 1; j++) {
                    head->friends[j] = head->friends[j + 1];
                }
            }
        }
        head = head->next;
    }

    // delete posts
    Post *curr_post = target->first_post;
    while (curr_post != NULL) {
        Post *next_post = curr_post->next;
        free(curr_post->author);
        free(curr_post->date);
        free(curr_post->contents);
        free(curr_post);
        curr_post = next_post;
    }


    //delete user
    User *curr_user = *user_ptr_del;
    // when target is the first user
    if (strcmp(curr_user->name, name) == 0) {
        *user_ptr_del = curr_user->next;
        free(curr_user->name);
        free(curr_user->profile_pic);
        for (int i = 0; i < MAX_FRIENDS; i++) {
            free(curr_user->friends[i]);
        }
        free(curr_user->friends);
        free(curr_user);
        return 0;
    //when target is the last user
    } else if (curr_user->next == NULL) {
        free(curr_user->next->name);
        free(curr_user->next->profile_pic);
        for (int i = 0; i < MAX_FRIENDS; i++) {
            free(curr_user->next->friends[i]);
        }
        free(curr_user->friends);
        free(curr_user->next);
        curr_user->next = NULL;
        return 0;
    } else {
        while (curr_user->next != NULL) {

            if (strcmp(curr_user->next->name, name) == 0) {
                User *next_user = curr_user->next->next;
                free(curr_user->next->name);
                free(curr_user->next->profile_pic);
                for (int i = 0; i < MAX_FRIENDS; i++) {
                    free(curr_user->next->friends[i]);
                }
                free(curr_user->next->friends);
                free(curr_user->next);
                curr_user->next = next_user;
                return 0;
            }
            curr_user = curr_user->next;
        }
    }
    return 1;
}