]> matita.cs.unibo.it Git - pkg-cerco/acc-trusted.git/blob - tests/test7.c
Control and copyright added.
[pkg-cerco/acc-trusted.git] / tests / test7.c
1 char a[] = {3, 2, 7, 1};
2 char treshold = 4;
3
4 unsigned int count(char(*foo)(char),char *a,int current, int high) {
5         int n = 0 ;
6         if (current < high)
7         {
8                 n = (*foo)(a[current]);
9                 current++;
10                 n += count(foo,a,current,high);
11         }
12         return n;
13 }
14
15 char smaller(char x) {
16         return (x < treshold);
17 }
18
19 int main() {
20         return (count(smaller,a,0,4));
21 }