progs: Makefile adjustments
[calu.git] / 8_benchs / angabe / max.c
1 /* computing the maximum over an array */
2 int max(int len, const int arr[]) {
3         int i;
4         int x = arr[0];
5         for (i = 1; i < len; i++) {
6                 if (x < arr[i]) {
7                         x = arr[i];
8                 }
9         }
10         return x;
11 }
12
13 int main() {
14
15         /* BENCHMARK START */
16         /* array for benchmark */
17         const int arr [] = { 2,  3,  5,  7, 11, 13, 17, 19,
18                                                  23, 29, 31, 37, 41, 43, 47, 53 };
19         int retval = max(16, arr);
20         /* BENCHMARK END */
21
22         return retval;
23 }