fork download
  1. #include <stdio.h>
  2.  
  3. typedef unsigned int (*FUNCPTR) (void *);
  4. typedef unsigned int FUNC (void *);
  5.  
  6. typedef struct _hoge {
  7. FUNCPTR pf; // 出来る
  8. FUNC * f1; // 出来る
  9. // FUNC f2; // 出来ない
  10. } hoge;
  11.  
  12. unsigned int func(void *d)
  13. {
  14. printf("%s(); called\n", (char *)d);
  15. return 0;
  16. }
  17.  
  18. int main()
  19. {
  20. hoge h;
  21.  
  22. h.pf = &func; h.pf("h.pf");
  23. h.f1 = &func; h.pf("h.f1");
  24. // h.f2 = &func; h.pf("h.f2");
  25.  
  26. return 0;
  27. }
Success #stdin #stdout 0s 1832KB
stdin
Standard input is empty
stdout
h.pf(); called
h.f1(); called