what are the valid arguments in a personal void function? [solved]

Hi to everyone reading.

I’m having a problem getting my coding to the next level. I’d like to reduce the redundancy and the copy-paste. Is there a way to having a void with a recall to a function inside the argument? i hope to have used the right terms, here’s my particular case:

void resetIn3(int k, void f()) {
  if (millis() - currentMillis > k && millis() - currentMillis <= k+1000) {
    lcd.setCursor(13, 0);
    lcd.print("3");
  }
  if (millis() - currentMillis > k+1000 && millis() - currentMillis <= k+2000) {
    lcd.setCursor(13, 0);
    lcd.print("2");
  }
  if (millis() - currentMillis > k+2000 && millis() - currentMillis <= k+3000) {
    lcd.setCursor(13, 0);
    lcd.print("1");
  }
  if (millis() - currentMillis > k+3000) {
    lcd.setCursor(13, 0);
    lcd.print("OK");
    f();
  }
}

void resetClock() {
  setTime(00, 00, 00, 01, 01, 1970);
  mode = 1;
}

I’d like to have resetClock executed within the resetIn3() when I write f(). Of course this is to re-use the countdown code with other functions beside resetClock().

Is it possible? the sketch compiles as it is, but when I write

resetIn3(2000, resetClock());

inside the void loop, it doesn’t compile… where ai I doing wrong?

ok, I just figured out myself, I needed to insert the line in the void as

resetIn3(2000, resetClock);

thats it =)

I didn't know that it wasn't necessary to use the funcion typical writing if the definition is already stated as a function within the argument

should i leave the thread active?

You can mark it solved by clicking the "Edit" button on the first post in the thread and then adding [solved] to the input field for the thread title.

Thanks!