fork download
  1. #include <iostream>
  2.  
  3. int add10(int summand) {
  4. int wert = 10 + summand;
  5. return wert;
  6. }
  7.  
  8. int func(int zahl, int (*f)(int)) { // Fehler. So würde ich es laut der Deklaration von cppreference.com deuten
  9. return (*f)(zahl);
  10. }
  11.  
  12. int main() {
  13.  
  14. int zahl = 12;
  15. std::cout << func(zahl, add10);
  16.  
  17. }
Success #stdin #stdout 0s 4548KB
stdin
Standard input is empty
stdout
22