Task

Write a procedure which accepts as arguments another procedure and a positive integer.

The latter procedure is executed a number of times equal to the accepted integer.




#include <stdio.h>
 
void repeat(void (*f)(void), unsigned int n) {
 while (n-->0)
  (*f)(); //or just f()
}
 
void example() {
 printf("Example\n");
}
 
int main(int argc, char *argv[]) {
 repeat(example, 4);
 return 0;
}
 