so Im trying to calculate a number raised to a power from user input, using scanf, but i keep on getting a segmentation fault.Does any one know why?This is my code:
int power( int base, int exponent){   
    int total=1;
    int temp = power(base, exponent/2);
    if (exponent == 0)
         return total;  // base case;
    if (exponent % 2 == 0)// if even
         total=  temp * temp;
         return total;
    if(exponent %2 !=0)// if odd
         total =(base * temp * temp);
         return total;
}
void get_info(){
    int base, exponent;
    printf("Enter a base number: ");
    scanf("%d", &base);
    printf("Enter an exponent: ");
    scanf("%d", &exponent);
    //call the power function
    printf("%d",power(base,exponent));
}
int main(){
    //call get_info
    get_info();
    return 0;
}
Any help would be much appreciated.Thank you.