Your function is called before the compiler has seen its definition, so the compiler is saying "I want to see this function's prototype first". This means you put void printPrimeFactor(int number, int factor);