I'm learning C from a fairly modern book so my questions will be beginner level for awhile yet...
Anyway, let's say I have a program with several different functions, and many of them have loops in them. Let's say I use "i" as my loop counter for each one.
Is it best to declare i before Main() ? This would make it a global variable wouldn't it, that means all of my functions could use "i" correct?
Also when would be the best time to initialize "i"? If I want to make sure i = 0 should I do that in Main() first or in my other functions before the loops?
If I have ++i in a function and then a function I call later on also uses "i" then will it have the same value it ended the loop with in the previous function? or will i = 0 or an unknown again?
I just need to know if its necessary to have i = 0; in each of my functions that use "i" as a counter variable for loops.