when the MAX_FRIEND th element is added, the first element of the friendlist is added too. why are two friends being added when the last element of friendlist is being set?
int make_friends(const char *name1, const char *name2, User *head) {
    // Create users friend1 and friend2
    User *friend1 = find_user(name1, head);
    User *friend2 = find_user(name2, head);

    // Check for user non-existence
    if (friend1 == NULL || friend2 == NULL) {
        return 4;
    }

    // Check for same user passed twice
    if (friend1 == friend2) {
        return 3;
    }

    // Check for full friends list
    if (friend1->friends[MAX_FRIENDS - 1] != NULL || friend2->friends[MAX_FRIENDS - 1] != NULL) {
        return 2;
    }

    // Check for friend already exists
    if (check_if_not_friends(friend1, friend2) == 1) {
        return 1;
    }

    // Set the first NULL element to friend2
    for (int i = 0; i < MAX_FRIENDS; i++) {
        if (friend1->friends[i] == NULL) {
            friend1->friends[i] = friend2;
            i = MAX_FRIENDS;  // Update i to exit the loop
        }
    }

    // Set the first NULL element to friend1
    for (int i = 0; i < MAX_FRIENDS; i++) {
        if (friend2->friends[i] == NULL) {
            friend2->friends[i] = friend1;
            i = MAX_FRIENDS;  // Update i to exit the loop
        }
    }

    return 0;
}


