fork download
  1. #include <stdio.h>
  2.  
  3. struct student{
  4. char id[9];
  5. short count;
  6. void (*addCount)();
  7. };
  8.  
  9. void student_addCount(struct student a){
  10. a.count++;
  11. }
  12.  
  13. int main(){
  14. struct student student;
  15. student.addCount = student_addCount;
  16. student.count = 0;
  17. student.addCount();
  18. student.addCount();
  19. student.addCount();
  20. student.addCount();
  21. student.addCount();
  22. printf("%d\n",student.count);
  23. }
Success #stdin #stdout 0s 4556KB
stdin
Standard input is empty
stdout
5