Integer power

This is a discussion on Integer power within the C Programming forums, part of the General Programming Boards category; What i gotta do:
Write a function called "integerPower(base, exponent)" that calculates and then returns the value of base to ...

Integer power

Write a function called "integerPower(base, exponent)" that calculates and then returns the value of base to the power exponent. For example, if you invoke the function in the following manner:

integerPower(3,4);

the function should return the value 81 (3 * 3 * 3 * 3 = 81). Assume that "exponent" is a positive nonzero integer and that "base" is an integer. You should use type "long" to represent the exponent and base. The function should return a "long" value as well. Do NOT use any math library functions as part of your solution.

Write a main() function to use (and test) your integerPower() function. Your main() function should request a base and exponent value from the user and then invoke the function with the values provided by the user.

As a general rule, it is prefered that you NOT input or output (scanf or printf) from inside a function. By having the calling program (main() in our case) do all the input and output, your function remains more general purpose.