source:
driver/tests/test7.c
@
3089
Last change on this file since 3089 was 3067, checked in by , 8 years ago | |
---|---|
File size: 429 bytes |
Line | |
---|---|
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 | } |
Note: See TracBrowser
for help on using the repository browser.