新日记
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1011 B

3 years ago
  1. ![image-20220408135535382](markdown.assets/typedef.assets/image-20220408135535382.png)
  2. ```
  3. FUNC1和FUNC2定义为返回值为int的,参数为(int)的整型和 返回值为int,参数为(int*, int*, int*) 的类型;
  4. ——————————————————————————————————————————————
  5. ——————————————————————————————————————————————
  6. ```
  7. ```c
  8. #include <stdio.h>
  9. int inc(int a)
  10. {
  11. return(++a);
  12. }
  13. int multi(int*a,int*b,int*c)
  14. {
  15. return(*c=*a**b);
  16. }
  17. typedef int(FUNC1)(int);
  18. typedef int(FUNC2)(int*,int*,int*);
  19. void show(FUNC2 fun,int arg1, int*arg2)
  20. {
  21. FUNC1 *p = &inc;
  22. int temp =p(arg1);
  23. fun(&temp,&arg1, arg2);
  24. printf( "%d\n ",*arg2);
  25. }
  26. int main()
  27. {
  28. int a;
  29. show(multi,10,&a);
  30. }
  31. ```
  32. ![image-20220408141812103](markdown.assets/typedef.assets/image-20220408141812103.png)