I was doing the tutorials to learn how to Arduino and there is an error

The Errors:

Arduino: 1.6.5 (Mac OS X), Board: “Arduino Uno”

Mini_piano:2: error: conflicting declaration ‘int buttons [0]’
Mini_piano:1: error: ‘buttons’ has a previous declaration as ‘int buttons [6]’
conflicting declaration ‘int buttons [0]’

The Code:

int buttons[6];
int buttons[0] = 2;
int notes = {262,294,330,349};

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}

void loop() {
// put your main code here, to run repeatedly:
int keyVal = analogRead(AO);
Serial.println(keyVal);
if(keyVal == 1023){
tone (8, notes[0]);
} else if (keyVal >= 990 && keyVal >= 1010) {
tones(8, notes[1]);
}
else if (keyVal >= 505 && keyVal <= 515) {
tone(8, notes[2]);
}
else if (keyVal >= 5 && keyVal <= 10){
tone(8,notes[3]);
}
else{
noTone(8);
}
}

The A0 is because it is connected to the A0

int buttons[6];
int buttons[0] = 2;

This is the problem, are you trying to set the second element of the array to 2?

// Can set up an array like this if you know what you want in it:
int buttons[6] = { 2, 3, 2, 3, 2, 3 };

// Or in your case 
int other_buttons[6];

// this line should be put in your setup() and sets the second element to 2.
other_buttons[2] = 0;

Hi,

This line is the problem:

Atron24:
int buttons[0] = 2;

The first issue is that it should be:

buttons[0] = 2;

by having the int part on the front, the compiler thinks you are trying to declare a second array with the same name.

The second issue is that you will need to move this line into the setup() function. alternatively, you could delete the line, and replace the line above with

int buttons[6] = {2, 0, 0, 0 ,0, 0};

Although, looking at your sketch further, it appears that you are not using buttons array, so you could probably just remove both those lines.