fork download
  1. #include <stdio.h>
  2.  
  3. typedef struct {
  4. void (*func)(int);
  5. } with_fp;
  6.  
  7. void test(int n) {
  8. printf("Test %d\n", n);
  9. }
  10.  
  11. int main(void) {
  12. with_fp s = {.func = test};
  13. with_fp *ptr = &s;
  14. ptr->func(123);
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0.01s 1720KB
stdin
Standard input is empty
stdout
Test 123