Pointer to pass the value of your array element to function

Modify the program so a pointer variable points to the “Blink” value array and use pointer math to correctly select the desired “Blink” value from the array. You may pass the dereferenced value to the “Blink” function or you may pass a pointer to the function and dereference there.

Here’s my code that runs with my RoboRed LED board. How can I point to the vallue in the array?

char input;
int arr[4]={1,2,3,5};

void setup() {
// initialize serial communication:
pinMode(LED_BUILTIN,OUTPUT);
Serial.begin(9600);
// initialize the LED pins:
Serial.println("Choose a letter: "); // prompts user to choose a letter

}

void BlinkFunction(int blinks){ //declaring my blink function
int i;
for (int i=0; i < blinks; i++) {
digitalWrite(LED_BUILTIN,HIGH); // turns LED on
delay(500); // on for 500ms
digitalWrite(LED_BUILTIN, LOW); // turns LED off
delay(500);

}
}

void loop() {
// read the sensor:
if (Serial.available() > 0) {
input = Serial.read();
switch (input){ // switch loop for each condition
case ‘a’: // if user chooses a…
BlinkFunction(arr [0]); // function from array spot 0
break;

case ‘b’: // if user chooses b…
BlinkFunction(arr [1]); // function from array spot 1
break;

case ‘c’:
BlinkFunction(arr [2]);
break;

default: ///if any other key is pressed
BlinkFunction(arr [3]);
}
Serial.read(); // end serial read
}
}

isoule:
Modify the program so a pointer variable points to the “Blink” value array and use pointer math to correctly select the desired “Blink” value from the array. You may pass the dereferenced value to the “Blink” function or you may pass a pointer to the function and dereference there.

That sure reads like a homework problem to me.

Here is a great tutorial on pointers: Pointers