Answers for "how to use a function as paramter for function in c++"

C++
1

c++ function parameters

void myFunction(string fname) {
  cout << fname << " Refsnes\n";
}

int main() {
  myFunction("Liam");
  myFunction("Jenny");
  myFunction("Anja");
  return 0;
}
Posted by: Guest on October-13-2021
0

c++ function as paramter

// function ask for void function with int param
void func ( void (*f)(int) );

// void function with int param :)
void print ( int x ) {
  printf("%d\n", x);
}

// pass print function to func 
func( print )
Posted by: Guest on November-02-2021

Code answers related to "how to use a function as paramter for function in c++"

Browse Popular Code Answers by Language