How to declare multiple variables with the same name

I wonder if there is any way to declare single variable that has multiple values by using a seperate variable.

For example, I've created an alarm clock code. In my code I've 4 different alarm times, hence 4 different alarm hours and 4 different alarm minutes, like below;

int alarmHour1 = 2; int alarmMinute1 = 0; int alarmHour2 = 10; int alarmMinute2 = 0; int alarmHour3 = 14; int alarmMinute3 = 0; int alarmHour4 = 18; int alarmMinute4 = 0;

In several different functions I use these variables.

if(now.hour() == alarmHour1 && now.minute() == alarmMinute1) //Activate alarm if enabled, not active yet and time is up { digitalWrite(AlarmOut, LOW); //Activate alarm output alarmMillis=millis(); alarmBlinkActivated=true; }

if(now.hour() == alarmHour2 && now.minute() == alarmMinute2) //Activate alarm if enabled, not active yet and time is up { digitalWrite(AlarmOut, LOW); //Activate alarm output alarmMillis=millis(); alarmBlinkActivated=true; }

.....The same code for alarm 3 and alarm 4

So I wonder if I can declare single alarmhour and alarmminute variable with several values inside?

For example I want something like this; int x=0 int alarmHour(x); int alarmMinute(x);

in this case I can change the value of x in desired locations in my code so I can create single function and process it depending on the value of x:

if(now.hour() == alarmHour(x) && now.minute() == alarmMinute(x)) //Activate alarm if enabled, not active yet and time is up { digitalWrite(AlarmOut, LOW); //Activate alarm output alarmMillis=millis(); alarmBlinkActivated=true; }

In this case if value of x is 1, then above if function looks for alarmHour(1) and alarmMinute(1) and so on.

The answer you are looking for is arrays ;)