PracticeDev/study_cpp/closer/closer.c

19 lines
257 B
C

#include <stdio.h>
typedef void (*Func)(int);
void printNumber(int i) {
printf("%d\n", i);
}
int main() {
Func funcArray[10];
for (int i = 0; i < 10; ++i) {
funcArray[i] = printNumber;
funcArray[i](i);
}
return 0;
}