They are exactly the same :
WHILE
INITIALIZE_1;
INITIALIZE_2;
...
INITIALIZE_N;
while(CONDITIONS) {
// your block code
...
# not only incrementation !!
OPERATION_1;
OPERATION_2;
...
OPERATION_N;
}
FOR
for (INITIALIZE_1, INITIALIZE_2, ..., INITIALIZE_N ; CONDITIONS ; OPERATION_1, OPERATION_2, ..., OPERATION_N) {
// your block code
...
}
for
is more comprehensive for a humain, so he can see in one line : the initialization, conditions and operations, but there are other cases when while
is more appropriate like :
while(NOT_QUIT_SIGNAL) { ... } vs for ( ; NOT_QUIT_SIGNAL ; ) { ... }
or
while(TRUE) { ... } vs for ( ; TRUE ; ) { ...}