fork(1) download
  1. #include <stdio.h>
  2.  
  3. typedef void show_type(int y,int x); /* show_type - typ który opisuje funkcje o takim prototypie */
  4.  
  5. void showyx(int y,int x) { printf("(%d,%d)\n",y,x); } /* jedna funkcja o takim prototypie */
  6. void showxy(int y,int x) { printf("(%d,%d)\n",x,y); } /* druga funkcja o takim prototypie */
  7.  
  8. void foo(show_type *fun /*, ... */ ) /* funkcja przyjmująca wskaźnik na taki prototyp */
  9. {
  10. /* ... */
  11. int x=2,y=3;
  12. fun(y,x);
  13. /* ... */
  14. }
  15.  
  16. int main()
  17. {
  18. foo(&showyx);
  19. foo(&showxy);
  20. return 0;
  21. }
Success #stdin #stdout 0s 2156KB
stdin
Standard input is empty
stdout
(3,2)
(2,3)