For loop syntax


Reference > Syntax > syntax of for loop

The syntax of for loop in c and c++ is

 for(initialization; condition ; increment)
{
 code
}


Example of for loop

for(a=1;a<=10;a++)      /*displays hello 10 times then stop*/
{
printf("hello\n");

}