Why do most of us use 'i' as a loop counter variable?
Posted
by
kprobst
on Programmers
See other posts from Programmers
or by kprobst
Published on 2011-06-24T23:38:27Z
Indexed on
2011/06/25
0:31 UTC
Read the original article
Hit count: 215
Has anyone thought about why so many of us repeat this same pattern using the same variable names?
for (int i = 0; i < foo; i++) {
// ...
}
It seems most code I've ever looked at uses i
, j
, k
and so on as iteration variables.
I suppose I picked that up from somewhere, but I wonder why this is so prevalent in software development. Is it something we all picked up from C or something like that?
Just an itch I've had for a while in the back of my head.
© Programmers or respective owner