Ok. I'm doing a Towers of Hanoi project and it's supposed to be a multi file program. I keep getting this error and I can't figure out why.
hanoi.c:4: error: redefinition of ‘hanoi’
hanoi.h:5: error: previous definition of ‘hanoi’ was here
Here's the code for hanoi.h
and for hanoi.cCode:void makeMove(int, int); void hanoi(int, int, int, int); extern in n; extern int noOfMoves; enum stacks{A = 1, B, C};
Code:#include "hanoi.h" void hanoi(int n, int src, int dest, int by) { if(n == 1) { makeMove(src, dest); } else { hanoi(n - 1, src, by, dest); makeMove(src, dest); hanoi(n-1, by, dest, src); } }



LinkBack URL
About LinkBacks


