Possible Duplicate:
Why do most of us use 'i' as a loop counter variable?

Maybe this questions seems to be extreamly stupid but I wonder why we use i as variable in most cases in for loops (and not other letter). This might be a historical cause.


for(int i = 0; i < 10; i++)
  • In my O'Reilly ABC book, i is for int
    – James
    Aug 19, 2011 at 13:50
  • By the way, I prefer ++i to i++ ;-) Aug 19, 2011 at 14:53
  • 2
    I prefer to use me
    – CamelBlues
    Aug 19, 2011 at 18:02

4 Answers 4


Long ago there was a programming language called FORTRAN, indeed the first so called higher programming language. In FORTRAN variables names beginning with i,j,k,l,m,n were implicitly declared of type INTEGER. So i can stand for:

  • integer
  • index (of an array, like in a[i])

or other things. Short names are typed quickly, so i is a good choice for a loop counter.

The FORTRAN convention goes deeper. Mathematicians love to name integer variables i,j,k,l,m, or n. They often use a,b,c,d,e,f for constant values and x,y,z for variables.


In FORTRAN IV, the variable names I-N were implicitly assumed to be integers. I think it's part of FORTRAN's legacy as a scientific computing language. Linear algebra uses integer indexes to derefence values in vectors and matricies. The convention diffused into other languages.


I guess the i stands for index.

Long ago, when computers were not that fast and memory and storage space was expensive, it was important to keep your source code small, so that it would fit in memory and the compilation process would run faster. Those things are not true anymore with today's computers, but still the i as the first index variable name stuck.


For what it's worth, I never use i. Perhaps this is a byproduct of using simpler text-editors, rather than IDEs, but I find it makes it very difficult to scan through a routine looking for places where the variable is used. To see what I mean, try searching for all the places i exists on this page, and seeing which ones refer to it as a variable, and which are incidental.

I always use more meaningful names, like

for(int Index = 0; Index < 10; Index++)
    // do something

Not the answer you're looking for? Browse other questions tagged or ask your own question.