lundi 21 novembre 2016

Why is this For Loop inside an IF Statement not being executed?

I have a c program that passes a string, or an array of chars to this function.

void cleanIp(char* stringToclean){
char stringToreturn[16];

//Iterare through array until you get to the charater "("
for(int i = 0; stringToclean[i] != '\0'; i++) {

    //Once you get to the character "(" add every character to string to return
    //Break once you get to ")"
    if (stringToclean[i] == '(')
    {
        printf("test\n");
        for(int j = 0; j > 15; j++){
            printf("test\n");
        }
    }

}

}

What I want to know is why it enters the if statement and prints the first test, however, it does not enter the for loop and print out 15 test after that. I see no reason as to why it would do this.

Aucun commentaire:

Enregistrer un commentaire