1 #include "hanoi.h"
2 
hanoi(int from,int to,int mid,int n,void (* callback)(int,int))3 void hanoi(int from, int to, int mid, int n, void (*callback)(int, int)) {
4   if (n == 1) {
5     callback(from, to);
6   } else {
7     hanoi(from, mid, to, n - 1, callback);
8     callback(from, to);
9     hanoi(mid, to, from, n - 1, callback);
10   }
11 }
12