Answer to Question #260589 in C++ for devi

Question #260589

Write a function to find the sum of array elements.

Int sum(int *);


1
Expert's answer
2021-11-03T17:47:50-0400
int sum(int arr[]) {
    int s = 0, l = sizeof(arr)/sizeof(*arr);


    for (int i = 0; i < l; i++) {
        s += arr[i];
    }
    return s;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS