Mercurial > hg > CbC > CbC_examples
view normal2.c @ 14:7d168c1829c9
modify makefile
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 17 Apr 2015 16:09:28 +0900 (2015-04-17) |
parents | 35d6eabeadb0 |
children |
line wrap: on
line source
#include<stdio.h> #include<stdlib.h> struct abc { int a; double b; char c; double *d; }; struct def { int d; struct abc e; struct abc *f; }; void print_abc(struct abc a){ printf("\tstruct abc:\n"); printf("\ta=%d, b=%lf, c=%d, d=%p\n", a.a, a.b, a.c, a.d); } void print_def(struct def b){ printf("\tstruct def:\n"); printf("\ta=%d, b=%p\n", b.d, b.f); print_abc(b.e); } void cs_exit(int a){ printf("cs_exit : a=%d.\n", a); exit(a); } void cs0(struct abc a, struct def b, int c){ printf("cs0 :\n"); print_abc(a); print_def(b); return cs_exit( c*a.a+b.e.c ); } void cs_goto(int c, struct abc a, struct def b){ printf("cs_return :\n"); print_abc(a); print_def(b); return cs0(a, b, c); } int main(int argc, char **argv){ struct abc A; struct def B; //int a=10, b=20, c=30, d=40, e=50, f=60, g=70; A.a = 10, A.b = 20.02, A.c = '\0', A.d = 0; B.d = 30, B.f = &A; B.e.a = 50, B.e.b = 60.06, B.e.c = '\1', B.e.d = 0; printf("main :\n"); print_abc(A); print_def(B); //printf("20*%d + 30*%d + 40*%d + 50*%d =\n", a, b, c, d); cs_goto(100, A, B); return 0; }