4 void hanoi(char from, char to, int disks)
6 char third = ('a' + 'b' + 'c') - from - to;
10 printf("%c -> %c\n", from, to);
14 hanoi(from, third, disks - 1);
15 printf("%c -> %c\n", from, to);
16 hanoi(third, to, disks - 1);
20 int main(int argc, char **argv)
24 printf("Usage: %s <from> <to> <disks>\n", argv[0]);
28 char from = argv[1][0];
30 int disks = atoi(argv[3]);
32 hanoi(from, to, disks);