does this code properly remove a friend from friendlists of all the users by shifting the list to the left by one after in the list after the user we want to remove? if not how can i fix it
void remove_friends(const char *name, User **ptr_users) {
    User *curr = *ptr_users;
    while (curr != NULL) {
        int f_count = 0;
        int u_count = 0;
        for (int i = 0; i < MAX_FRIENDS; i++) {
            if (curr->friends[i] != NULL) {
                f_count++;

                if (strcmp(curr->friends[i]->name, name) == 0) {
                    u_count = f_count;
                }
            }
        }

        for (int x = u_count; x < f_count - 1; x++) {
            curr->friends[x] = curr->friends[x + 1];
        }

        curr->friends[f_count - 1] = NULL;

        curr = curr->next;
    }

}