Can please someone help me to choose the right answer for this?? the answer can
ID: 3811373 • Letter: C
Question
Can please someone help me to choose the right answer for this?? the answer can be more than one, I am not sure which one(s) are/is the right answer, anyone?? This is a C programming class
Which are examples of tail recursion? O int sum (int in, count) if (count 0) return 0 int retval sum (in sizeof (int) Count 1) retval ln. return ret val; O int sum (int in, count) f if (count 0) return 0 return sum (in sizeof (int) Count 1) ln. O int sum (int in, count) f if (count 0) return 0 int retval ln. retval sum (in sizeof (int) count 1) return ret val; O int sum (int in, count) f if (count 0) return 0 return ln. sum (in sizeof (int) Count 1)Explanation / Answer
option 2 and option 4 are tail recursive function examples. In the tail recursion first the calculations of functions will be done and then the recursion is happened atlast with the updated values. In the tail recursion the recursive statement is the last one which gets executed.
In the above exmples option 2 and 4 are the functions which get calls the function at the last. Which is nothing but tail recusion.