
You can use it undercover by means of a macro #define i index





Why not just skip to "spa"





i am using 'i' and 'j' for iterating 2D arrays because 'i' and 'j' mean x and y in Cartesian coordinates.
http://butterfly.blog.ir[^]





Don't they mean 'horizontal' and 'vertical' ?





maybe but I don't think so.
horizontal > h not 'i'
&
vertical >v not 'j'
the 'i' and 'j' are symbols for horizontal and vertical vectors.





probably i > row and j > column then





Hmmmmm...





I think you are right. If not otherwise defined FORTRAN would default to integer variables whose names started with "I" through "l" (ell) I believe. Not too sure about the ending letter as all *good* programmers defined their variables.
After years of programming I still use "t" for temporary variables (like creating a value for the debugger to see) and "t.t" for file names for the same sort of thing  temporary names while developing. This comes from the old TRS80 system.
Old habits die hard, eh?






WPerkins wrote: If not otherwise defined FORTRAN would default to integer variables whose names started with "I" through "l" (ell) I believe...
Right, and this spawned the expression "God is real (unless declared integer)".

Harvey





I just asked Him, he said "Don't Fret It, Dude".
Amazing how much hold over there is. IBM PCs in the mid 1980s had screens that were 25 rows by 80 columns... same dim as punch cards.
I wonder how much hold over we've gotten from APL and ADA  even those of us who never wrote any APL or ADA.
Topic for another thread perhaps.
I am currently working on a big project in Delphi 7  circa 2005 code. I thought Pascal had died about the same time as Milli Vanilli... guess not.
Disco rocks, by the way.





I always use index and sometimes preppend it with the object or value i am indexing. It leads to a bit more verbose code but it is a hell of a lot easier to understand. Just my opinion.





Yes, it started in FORTRAN and leads to the following joke:
God is real unless declared integer
At least now you have the context so you can see the humor





Sorry, I still don't see the humour!
(Sound of tumbleweed blowing)





Since I, j, k, l are int by default, a variable named God would, by default, be a 'real' number  ie, floating point. You'd have to declare the variable God to be an integer in order for it to be taken that way.
Yes, this is probably a good candidate for the most delayed response ever.





mc42 wrote: Yes, this is probably a good candidate for the most delayed response ever.
It did take me a while to get the context there. Thanks for explaining.
It does tickle me that an Imaginary being defaults to Real, while i is definitely not imaginary. Mathematicians would shudder.
(Edited for grammar)
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.





In my mind, it was because of FORTRAN. Back in the day, we didn't have all that many languages to choose from and most of us wrote in 360 assembler, FORTRAN, or COBOL. As others have said, while FORTRAN did have typing, variables starting with in were defaulted to integers so we just used i  followed by j, k, l in nested loops  for simplicity.
We also used foo, foobar, and jane for "temp" variables. foo and foobar were common for IBM programmers and jane was common in DEC code.





I've never used fortran, I always thought of 'i' as an unnamed integer. A throwaway variable.





now that you made me think of it, I realized of my habit of using "t" instead of "i" as my favorite looping variable. It's because I learned of FOR loops back in 1984 when typing BASIC programs on my Commodore VIC20. The user manual had several soundeffects example listings, mostly composed of a FOR T=something statement, where T stayed (I guess) for time. I typed many of them and eventually got the habit of the "t" variable.
Effects were something like this:
10 REM LUNAR LANDING EFFECT
15 POKE 36878,15
20 FOR T=200 TO 120 STEP 1
30 POKE 36876,T
40 FOR I=1 TO 100:NEXT I
50 NEXT T
(for the curious ones, 368678 was for volume "up" and 36876 for playing tone).





I use i because I was taught so in school, also every example in any book use i (j, k, etc.) as loop variables so I assume it seems natural to me. By the way I always thought i stood for index.





Yes, as others have said for many it was a carryover from FORTRAN. Nothing formal that I know of, just using i in FORTRAN and then out of habit using it in 'C' as programmers moved over to that and other newer languages.





When I first learned about mathematical functions f(x)(a dozen years before my first programming class) I was told mathematicians used "i" for the first incrementing variable, "j" for the next and so on.
When I started to learn programming languages, a FORTRAN professor (FORTRAN as in "FORmula TRANslation") who (of course) was a member of the Math department, said something along the lines of "This is not the theology department but using anything other that "I" for the first incremental etc is heresy. Those who want to use 'meaningful words' should consider being English or Philosophy majors and take Professor SoandSo's COBOL class."
So, 'I' as an index did not start with FORTRAN, it started before FORTRAN, but it fit nicely because those who used FORTRAN knew its meaning from math studies.





Yes, it is so: i, j and k are standard notation for mathematical arithmetic progressions and series.
From well before FORTRAN. But FORTRAN was designed by mathematicians, so we programmers are carrying over the notation.
a,b,c > constants
x,y,z > unknown terms (or real coordinates in cartesian plane)
k,j,i > INTEGER indexes or vector coordinates.
I think Gauss was already using this conventions, more than 100 years ago.
Gauss wins. As always.






Fortran probably got it from math.
Now math... I don't know.



