comparison CbC-examples/test04.c @ 16:4c6926a2b9bc

examples.
author kent <kent@cr.ie.u-ryukyu.ac.jp>
date Thu, 24 Sep 2009 12:51:25 +0900
parents
children 5d30d517ebed
comparison
equal deleted inserted replaced
15:11a6cbe2d14c 16:4c6926a2b9bc
1
2 int test01(int a, double b, int *c){
3 return a+b- *c;
4 }
5
6 int test(int *a, double b){
7 int c;
8 c = *a*b + 10;
9 printf("a = %x, *a = %d, b = %d\n", a, *a, b);
10 *a = test01( *a+b, 0.02, &c);
11 return *a+b;
12 }
13
14
15 int test02(int a, int b){
16 int i,sum=0;
17 i = a;
18 while ( i <= b ) {
19 sum += i;
20 i++;
21 }
22 return sum - a*b;
23 }
24
25 int main(int argc, char **argv){
26 int a=10;
27
28 printf("= %d\n", test02(0, 10));
29 test( &a, 10.1);
30 return 0;
31 }
32
33