'i' does not name a type - just an integer

Hi,

I'm trying to put this into global scope.

int i;
i=0;

It's just before loop to count the iterations, but it keeps coming up with the 'i' does not name a type. Googling this comes up with this error occurring for library use and the solution is to rearrange the library files. However I don't think this is applicable here as it's literally just an integer I'm trying to use so I'm confused!

The error comes up for i=0.

Advice is greatly appreciated as always.
Thanks - Rachael.

Either do the assignment as part of the declaration or do it in a function

Thanks! Part of the declaration worked can't believe it was that simple.

Helps if you learn a bit about programming first.

Rachael_N:
Thanks! Part of the declaration worked can't believe it was that simple.

The reason why it failed originally was that you can't have code outside of a function and

i=0;

even though it is very short, is code whereas

int i = 0;

is a declaration and initialisation of a variable