When i push the first button ( switch red ) the serial Monitor shows:green is pressed so , the led $#$%%^ was turned ongreen is pressed so , the led $#$%%^ was turned ongreen is pressed so , the led $#$%%^ was turned on

byte index = 4; if(digitalRead(inputPins[index]) == HIGH){ digitalWrite(ledPins[index], HIGH); Serial.print(switchPinNames[index]); Serial.print(" is pressed, so the "); Serial.print(ledPinNames[index]); Serial.println(" LED was turned on");}You are already reading the pin state in the for loop. Why do it again?

You have arrays of size 4, with indices ranging from 0 to 3. You have tried to access the 5th element of several 4 element arrays.

if(digitalRead(inputPins[index]) == HIGH) {digitalWrite(ledPins[index], HIGH);Serial.print(switchPinNames[index]);Serial.print(" is pressed, so the ");Serial.print(ledPinNames[index]);Serial.println(" LED was turned on"); }

else {digitalWrite(ledPins[index], LOW); // turn LED off } }}

The value of index is what points to the desired element in your array.