Advertisement
mierzvoj

Untitled

Jun 8th, 2022
649
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.50 KB | None | 0 0
  1.  
  2. #include <stdio.h>
  3.  
  4. int Add(int a, int b){
  5.     return a + b;
  6. }
  7. typedef int (*ptr)(int, int);
  8. void Print(char *name){
  9.     printf("Hello\n");
  10. }
  11.  
  12. struct functions{
  13.     ptr print;
  14. };
  15.  
  16. int
  17. main ()
  18. {
  19.     int c;
  20.     int (*p)(int, int);
  21.     p = &Add;
  22.     c = (*p)(2, 3);
  23.     printf("%d", c);
  24.    
  25.     void (*ptr)();
  26.     ptr = &Print;
  27.     ptr("fdfdf");
  28.    
  29.     struct functions Functions;
  30.     struct functions *func = &Functions;
  31.    
  32.     func = Functions.print(2, 3);
  33.    
  34.   return 0;
  35. }
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement