Mega Code Archive

 
Categories / C Tutorial / Statement
 

Initialize loop control variable outside the for statement

#include <stdio.h> int main(void) {   int count = 1;   for( ; count <= 10 ; ++count)     printf("\n%d", count);   printf("\nWe have finished.\n");   return 0; } 1 2 3 4 5 6 7 8 9 10 We have finished.