vendredi 8 juillet 2016

if in while loop in C

I have the following code:

while(tmp->next != NULL)
{
    if(tmp->code == (unsigned int)16777221)
    {
        CU_ASSERT_STRING_EQUAL("3GPP Zh", tmp->name);
    }
    if(strcmp((const char*)tmp->name, (const char*)"IUT-T Rs") == 0)
    {
        CU_ASSERT_EQUAL((unsigned int)16777235, tmp->code);
    }
    tmp = tmp->next;
}

What I want to do is this: once the code in the if structure is executed (that is to say, the if condition is evaluated to true), I don't want to execute it anymore in all the following while loops, how could I do this?

Aucun commentaire:

Enregistrer un commentaire