C Programming Code Examples C > Beginners Lab Assignments Code Examples find sum of array elements using pointers, recursion & functions find sum of array elements using pointers, recursion & functions Sum of array elements using Recursion: Function calling itself This program calls the user defined function sum_array_elements() and the function calls itself recursively. #include<stdio.h> int main() { int array[] = {3,6,9,12,15,18,21}; int sum; sum = sum_array_elements(array,6); printf("\nSum of array elements is:%d",sum); return 0; } int sum_array_elements( int arr[], int n ) { if (n < 0) { //base case: return 0; } else{ //Recursion: calling itself return arr[n] + sum_array_elements(arr, n-1); } }