From b52b74ea5067b51a5ee4c56beae3ed4bf4078934 Mon Sep 17 00:00:00 2001 From: adithyaanilkumar Date: Mon, 29 Jun 2020 09:45:14 +0530 Subject: [PATCH] added uninon --- C/uninon.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 C/uninon.c diff --git a/C/uninon.c b/C/uninon.c new file mode 100644 index 0000000..ccf4dc5 --- /dev/null +++ b/C/uninon.c @@ -0,0 +1,27 @@ +//sizeof() an union example + +#include +void main() +{ + int a; + float b; + struct student_details + { + char name[20]; + int regno; + }student; + + union code + { + int x; + char c; + float y; + }sample; + + printf("size of variable a=%d\n",sizeof(a)); + printf("size of variable b=%d\n",sizeof(b)); + printf("size of structure variable is %d\n",sizeof(student)); + printf("size of union variable is %d\n",sizeof(sample)); + printf("size of integer is %d\n",sizeof(int)); + +} \ No newline at end of file