0

It's output is 30 but,how is it giving an output when there is no return value when it calls f(0)?

    #include<stdio.h>
    main()
    {
        int n=10;
        int f(int n);
        printf("%d",f(n));
    }
    int f(int n)
    {
    
        if(n>0)
        {
            
              return(n+f(n-2));
              
        }
       
    }
  • 3
    @Carcigenicate I find it a bit frustrating that the accepted answer does not clearly state that this behavior is undefined. – Eugene Sh. Sep 14 '20 at 16:04
  • @EugeneSh. Ya, you're right. It isn't explicitly said until the third answer down, which is odd. Is there a more typical dupe? – Carcigenicate Sep 14 '20 at 16:05

0 Answers0