is this code correct? if not what do i need to to do to fix it

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
    for (int i = 0; i < MAX_FRIENDS; i++) {
        if (friend1->friends[i] == friend2 || friend2->friends[i] == friend1) {
            return 1;
        }
    }

    // Create variables to track if the friends were added to each other's
    // friend lists
    int f1_added = 0;
    int f2_added = 0;

    // Create a counter to track list index
    int count = 0;

    // Keep looping so long as a new friend is not added to both users
    while (f1_added == 0 || f2_added == 0) {
        if (friend1->friends[count] == NULL && f1_added == 0) {
            friend1->friends[count] = friend2;
            f1_added = 1;     // Track that friend2 was added to friend1's friendlist

        }
        if (friend2->friends[count] == NULL && f2_added == 0) {
            friend2->friends[count] = friend1;
            f2_added = 1;  // Track that friend 1 was added to friend2's friendlist

        }
        count++;
    }
    return 0;
}
