projects
/
libfirm
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
improved fehler101.c. Now with printing!
[libfirm]
/
ir
/
be
/
test
/
am_test2.c
1
#include <stdio.h>
2
3
int arr[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
4
5
int sum(int from, int to) {
6
int i, res = 0, res2 = 666;
7
int len = to - from;
8
9
for(i = 0; i < len; ++i) {
10
res += arr[from + i];
11
res2 -= arr[i];
12
}
13
14
return res ^ res2;
15
}
16
17
int main(int argc, char **argv) {
18
int from = 0;
19
int to = 10;
20
if(argc > 1)
21
to = atoi(argv[1]);
22
23
printf("Res: %d\n", sum(from, to));
24
return 0;
25
}