Jim Stichnoth | 5bc2b1d | 2014-05-22 13:38:48 -0700 | [diff] [blame] | 1 | // This is a simple loop that sums elements of an input array and |
2 | // returns the result. It's here mainly because it's one of the | ||||
3 | // simple examples guiding the early Subzero design. | ||||
4 | |||||
5 | int simple_loop(int *a, int n) { | ||||
6 | int sum = 0; | ||||
7 | for (int i = 0; i < n; ++i) | ||||
8 | sum += a[i]; | ||||
9 | return sum; | ||||
10 | } |