daily pastebin goal
30%
SHARE
TWEET

Untitled

a guest Jul 12th, 2018 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  
  3. int square(int number);
  4. void recursionAndThen(int countDown, void *myFunction);
  5. void printName();
  6.  
  7. int main(void) {
  8.   printf("Hello World\n");
  9.   int ivar = 1;
  10.   if( ivar == square(ivar) ) {
  11.     printf("ivar has no changes");
  12.   }
  13.  
  14.   recursionAndThen(5, &printName);
  15.  
  16.   return 0;
  17. }
  18.  
  19. void printName() {
  20.   int i = square(9);
  21.   printf("9 squared is %d\n", i);
  22. }
  23.  
  24. int square(int number) {
  25.   return number * number;
  26. }
  27.  
  28. void recursionAndThen(int countDown, void *aFunction) {
  29.   if(countDown > 0) {
  30.    countDown = countDown - 1;
  31.    printf("count is: %d\n", countDown);
  32.    recursionAndThen(countDown, aFunction);
  33.    return;
  34.   }
  35.  
  36.   void (* newFunction)() = aFunction;
  37.   (*newFunction)();
  38. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top