Syntax questions

Hi

I have variables such as

int var1;
int var2 ;
int var3;

and in the code I have a for loop which is

for(int i = 1; i <= 3; i++) {

Serial.println (var(i));
}

Dosen't work as it was just a guess?

So my question is how do I code it so that it will print the next variable as the counter increases.

Thanks in advance

Sounds like you need to use an array:

int a[3];

void setup ()
{
  a[0] = 23;
  a[1] = 45;
  a[2] = 76;

  Serial.begin (9600);
}

void loop ()
{
  int i;

  for (i = 0; i < 3; i++) {
    Serial.println (a[i]);
  }
}