Mercurial > hg > CbC > CbC_examples
diff test04.c @ 2:35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 22 Oct 2014 02:06:29 +0900 |
parents | bacef8675607 |
children |
line wrap: on
line diff
--- a/test04.c Wed Oct 22 00:38:01 2014 +0900 +++ b/test04.c Wed Oct 22 02:06:29 2014 +0900 @@ -1,33 +1,33 @@ - +#include<stdio.h> int test01(int a, double b, int *c){ - return a+b- *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 c; + c = *a*b + 10; + printf("a = %p, *a = %d, b = %f\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 i,sum=0; + i = a; + while ( i <= b ) { + sum += i; + i++; + } + return sum - a*b; } int main(int argc, char **argv){ - int a=10; + int a=10; - printf("= %d\n", test02(0, 10)); - test( &a, 10.1); - return 0; + printf("= %d\n", test02(0, 10)); + test( &a, 10.1); + return 0; }