i am passing values to function by variable but i am getting inside the function a different values.
float MATH_Pow(float base,int exponent) {
float value=1;
if ( exponent > 0 ){
while (exponent != 0)
{
value *= base;
--exponent;
}
return value;
} else if (exponent < 0){
while (exponent != 0)
{
value *= base;
++exponent;
}
return 1/value;
} else if (exponent == 0){
return value;
}
}
this is how i am calling the function.
int base=5;
int Exponent=2;
result = MATH_Pow(base,exponent)
but when i am Debugging i am finding different values like 2342345499 for the base and exponent paramenters something not logic.
thanks for your help.