1 / 15 Settings
<<<>>>

Now consider a simple recursive function to sum the elements of an array. The information flow passes the array and the index forward during the winding phase. The sum of the values is passed backward during the unwinding phase.

  • int sum(int arr[], int n) {
  • if (n == 0) {
  • return 0;
  • }
  • return sum(arr, n - 1) + arr[n - 1];
  • }
arr
  1. 20
  2. 41
  3. 62
Proficient Saving... Error Saving
Server Error
Resubmit