sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1 | |
2 | #include <stdio.h> | ||||
3 | #include <stdlib.h> | ||||
4 | |||||
5 | __inline__ | ||||
6 | static int addemup ( int* arr ) | ||||
7 | { | ||||
8 | int i, j = 0; | ||||
9 | for (i = 0; i <= 10; i++) | ||||
10 | j += arr[i]; | ||||
11 | return j; | ||||
12 | } | ||||
13 | |||||
njn25 | e49d8e7 | 2002-09-23 09:36:25 +0000 | [diff] [blame] | 14 | int main ( void ) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 15 | { |
16 | int sum; | ||||
17 | int* a = calloc(10, sizeof(int)); | ||||
18 | sum = addemup(a); | ||||
19 | printf("sum is %d\n", sum); | ||||
njn25 | e49d8e7 | 2002-09-23 09:36:25 +0000 | [diff] [blame] | 20 | return 0; |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 21 | } |