Hey everyone I'm a beginner programmer and I have a problem with my recursive code to calculate the factorial of a number.
I get segmentation fault and I don't know why that's the case.
Any help would be very much appreciated :)
(In my code I'm trying to calculate the factorial of 4 for example)
#include <stdio.h>
int factorial(int i) {
    int result = i * factorial(i - 1);
    return result;
}
int main()
{   
    int result = factorial(4);
    printf("result is %d", result);
}   
 
     
    