You are here

for loop in C

for is a keyword of C programming language. It is frequently used in C programs. We will discuss how to use for loop and it's variations with different program examples.

for (initialization; condition checking; increment or decrement)
all the three are optional.

Initialization is used to initialize variables.
for example, for (a = 1, b = 2;;) // a and b are variables

Condition checking is used for checking one or more conditions.