Using the Arduino/C IDE, I find there is no satisfactory place to define variables. As far as I can tell, there are 3 places that variables can be defined, and none of them are satisfactory.
(a) You can define your variables right at the start, before setup() or loop(), in the same place that you include libraries etc. However, variables defined here are global, meaning seen inside all of the functions you define, so this is clearly not satisfactory except in special cases where you wish the variable(s) to be global, or in very simple programs.
(b) You can define variables in setup(), but these will only be seen in setup(), which is generally useless.
(c) You can define variables in loop(), but then you can't initialize them in setup(), because they won't be seen there. Furthermore, you can't in any useful way initialize them in loop() either, because they will be re-initialized on every iteration of loop().
What am I missing? As far as I can see, there is nowhere you can define your variables, have them initialized once, and not be global.
The only way I can see around this, is to treat setup() as your main program, which of course will include an endless loop, and never use or execute loop().
Is it me that is nuts, or the rest of the world. :D