Mercurial > hg > CbC > CbC_examples
view parallel_check/c-struct.c @ 5:90e6146d24cd
fix stack1.c
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 22 Oct 2014 19:02:57 +0900 |
parents | bacef8675607 |
children |
line wrap: on
line source
#include<stdio.h> #include<math.h> #define dprint(f, args...) \ printf("in %s env=%p: "f, __FUNCTION__, __builtin_frame_address(1), ## args) typedef struct { int a; double b; char *c; } STRUCT; int test(int a) { return (int)pow(a, 2.0); } int callee(int a, STRUCT s, int b) /* |-|----|-| */ { dprint("a=%d,b=%d\n", a,b); dprint("s.a=%d,s.b=%lf,s.c=%s\n", s.a, s.b, s.c); return a+b+ s.a; } int caller(STRUCT s, int a, double b) /* |----|-|--| */ { STRUCT s0;// = {44, 55.5, "aiueo2"}; //int a0 = 55; //a0 = a; s0 = s; return callee(10, s0, 20); } int main (int argc, char **argv) { int r; STRUCT s = { 33, 44.4, "aiueo" }; r = caller(s, 11, 22.2); //r = caller(11,22,33,44, 55,66,77,88); printf("r = %d\n", r); }