C Programming Reference


C Programming Reference >> C Basic Tutorials >> C Keywords Home >>

forui

30/12/06 -  Views - Ratings :   3.48 of 5 / 155 Votes

This keyword is used to generate loops. This keyword is very frequently used. Every for statement has three parts, intialisation, conditon and increment. Intialisation intialise the loop control variable, Condition checks the conditon for loop execution and increment changes the value of loop control variable. These parts can do more than above mention function but its highly reommended you use them traditionally. Any or all of the above parts can be empty. Each parts are seprated by semicolon. Multiple staments in each part can be linked together using comma. For can also be used to generate infinite loops.

Code -
void function (void)
{

int a,b;
for (a = 0, b = 10; a < b;a++)
 {
   printf ("%d", a); \\ Prints numbers 0 to 9

 } 
}

Back To Top


      

 

 

© 2006 cencyclopedia.com