I have the following code:
(I kept only the relevant part for my question)

```
        // Structure
        struct first_list {
            char firstname[100];
            struct first_list * next;
        };
        struct last_list {
            char lastname[100];
            struct last_list * next;
        };

        void verify_name()
        {
            char firstname[100];
            char lastname[100];
            struct first_list * curr_first = loaded_first;
            struct last_list * curr_last = loaded_last;

        /////////// this part was added by me
            while( curr_last != NULL )
            {
                strncpy(lastname, curr_last->lastname, sizeof( lastname ) - 1 );
                valid = validate_name(sock,buffer,sizeof(buffer),firstname);
                if(valid < 1)
                    fprintf(stderr, "%s is VALID\n", lastname);
                else
                    fprintf(stderr, "%s is invalid\n", lastname);

                curr_last = curr_last->next; //this is used for removing current record

            }
            printf( "LastName validation complete\n" );
            break;
        /////////// end of part added by me

            while( curr_last != NULL && curr_first != NULL )
            {
                strncpy(firstname, curr_first->firstname, sizeof( firstname ) - 1 );
                strncpy(lastname, curr_last->lastname, sizeof( lastname ) - 1 );

                ////////////////////////////////
                //// irrelevant code (functions)
                ////////////////////////////////

                if( curr_first->next == NULL && curr_last->next != NULL)
                {
                    curr_last = curr_last->next;
                    curr_first = loaded_first;
                }
                else 
                    curr_first = curr_first->next;
            }
        }

```

so, I added a new function to validate lastnames before the function which validates firstnames and lastnames at the same time (to optimize the whole process). The problem is that if I remove the break command I get an error cause last\_list is empty after validation.

***How can I keep only the valid last names in the structure because right now when is moving to the next record it is deleting the current one until loop is complete(NULL) ??***