Mercurial > hg > CbC > CbC_examples
diff test04.c @ 0:bacef8675607
init repository
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 14 Oct 2014 17:34:59 +0900 |
parents | |
children | 35d6eabeadb0 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test04.c Tue Oct 14 17:34:59 2014 +0900 @@ -0,0 +1,33 @@ + +int test01(int a, double b, int *c){ + return a+b- *c; +} + +int test(int *a, double b){ + int c; + c = *a*b + 10; + printf("a = %x, *a = %d, b = %d\n", a, *a, b); + *a = test01( *a+b, 0.02, &c); + return *a+b; +} + + +int test02(int a, int b){ + int i,sum=0; + i = a; + while ( i <= b ) { + sum += i; + i++; + } + return sum - a*b; +} + +int main(int argc, char **argv){ + int a=10; + + printf("= %d\n", test02(0, 10)); + test( &a, 10.1); + return 0; +} + +