dimanche 9 février 2020

What does the test “if (i && (i- 1))” mean?

I don't understand this line of code:

if (i && (i - 1))
    printf("%d\n", p[i - 1]);
int main(void) {
    int p[7] = {-5, 1, 4, -7, 2, 8, 0};
    int i;

    for (i = 0; i < 7; i++) {
         if (i && (i - 1))
            printf("%d\n", p[i - 1]);
    }
    return 0; 
}

Aucun commentaire:

Enregistrer un commentaire