Mercurial > hg > CbC > CbC_examples
view test_struct.c @ 20:c181f93d4e30
minor fix
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 25 Jan 2016 09:53:21 +0900 |
parents | 35d6eabeadb0 |
children |
line wrap: on
line source
#include<stdio.h> struct aaa{ int a; // 4 char b; // 1 int c; // 4 double d; // 8 char e[10]; //10 }; //27 --> 32 void tset01(struct aaa B, int size); int main(int argc, char **argv){ struct aaa A; A.a = 10; A.b = 'A'; A.c = 20; A.d = 1.11; A.e[0] = 'A', A.e[1] = 'Z'; printf("sizeof aaa = %lu\n", sizeof(struct aaa)); tset01(A, 10); return 0; } void tset01(struct aaa B, int size){ printf("B.a = %d\n", B.a); printf("B.b = %d\n", B.b); printf("B.c = %d\n", B.c); printf("B.d = %lf\n", B.d); B.e[9] = '\0'; printf("B.e = %s\n", B.e); printf("size = %d\n", size); }