view CbC-examples/test04.c @ 45:d645ac0f55d6

add instration howto for PS3 to CbC-INSTALL.
author kent <kent@cr.ie.u-ryukyu.ac.jp>
date Fri, 29 Jan 2010 12:18:08 +0900
parents 4c6926a2b9bc
children 5d30d517ebed
line wrap: on
line source


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;
}