typedef struct user {  
    char name[MAX_NAME];  
    char profile_pic[MAX_NAME];  // This is a *filename*, not the file contents.  
    struct post *first_post;  
    struct user *friends[MAX_FRIENDS];  
    struct user *next;  
} User;  

int make_friends(const char *name1, const char *name2, User *head) {
    if (strcmp(name1, name2) == 0){
            return 3;
    }

    if (find_user(name1, head) == NULL || find_user(name2, head) == NULL){
            return 4;
    }

    User *user1 = find_user(name1, head);
    User friends1[MAX_FRIENDS];
    int i = 0;
    while ((*user1).friends[i] != NULL){
            friends1[i] = *(*user1).friends[i];
    }
    User *user2 = find_user(name2, head);
    User friends2[MAX_FRIENDS];
    int j = 0;
    while ((*user2).friends[j] != NULL){
            friends2[j] = *(*user2).friends[j];
    }

    int count1 = 0;
    int count2 = 0;

    int x = 0;
    int y = 0;
    while (friends1[x] != NULL){
            if (friends1[x] == *user2){
                   return 1;
            }
            x++;
            count1++;
            if (count1 > 10){
                    return 2;
            }
    }
    while (friends2[y] != NULL){
            y++;
            count2++;
            if (count2 > 10){
                    return 2;
            }
    }
    friends1[x] = *user2;
    friends2[y] = *user1;
    return 0;
}

Make two users friends with each other.  This is symmetric - a pointer to
 * each user must be stored in the 'friends' array of the other.
 *
 * New friends must be added in the first empty spot in the 'friends' array.
 *
 * Return:
 *   - 0 on success.
 *   - 1 if the two users are already friends.
 *   - 2 if the users are not already friends, but at least one already has
 *     MAX_FRIENDS friends.
 *   - 3 if the same user is passed in twice.
 *   - 4 if at least one user does not exist.
 *
 * Do not modify either user if the result is a failure.
 * NOTE: If multiple errors apply, return the *largest* error code that applies.