Simple Array Sum

  • + 0 comments

    Just use recursion!

    int simpleArraySum(int ar_count, int* ar) {
        if (ar_count == 0) return 0;
        else return ar[0] + simpleArraySum(ar_count - 1, ar+1);
    }