dimanche 21 août 2016

I have trouble understanding about blocks of for loop and if statement

In C Primer Plus, the author says that

A C99 feature, mentioned earlier, is that statements that are part of a loop or if statement qualify as a block even if braces (that is, { } ) aren’t used. More completely, an entire loop is a sub-block to the block containing it, and the loop body is a sub-block to the entire loop block.

I guess the loop body means the printf(...) statement in the example below. But what do these these two bold words mean? : ".. an entire loop is a sub-block to the block containing it,..." It would be nice if you could explain it using the example below!

for(int n =1;n<3;n++)
    printf("%d \n",n);

Aucun commentaire:

Enregistrer un commentaire