Originally Posted by
christop
I would try using pow() again instead of your power() function. It could have been the missing -lm that caused it not to work with variables for you (the compiler probably replaced pow(constant, constant) with a constant value without a call to pow())