• edited by
5,914 views
12 12 votes
#include <stdio.h>
int f(int *a,int b) {
  b = b-1;
  if(b == 0) return 1;
  else {
    *a = *a+1;
    
  return  *a + f(a,b)  ;
  }
}
int main() {
  int X = 5;
  printf("%d\n",f(&X,X));
}

Predict the output

If the return statement was

return  f(a,b)+ *a ;

What would have been the output here ?  Explain why there is change in output (if any)

1 Answer

Position:
Show:

Related questions

1 1 vote
1 1 answer
336
336 views
khanshahima4 asked Sep 24
336 views
1. If precedence tells me which operator has priority, and associativity tells me how to handle operators at the same level, then why do I need a separate concept called ...