Introduce examples dir
[lcapit-junk-code.git] / examples / C / union.c
blobfbf05698cef9e9f8a0259fade2daae6cfa96e988
1 #include <stdio.h>
3 union teste {
4 char ch;
5 int i;
6 };
8 struct teste2 {
9 char ch;
10 int i;
13 int main(void)
15 union teste teste;
16 struct teste2 teste2;
18 teste.ch = 'c';
19 printf("%c\n", teste.ch);
21 teste.i = 666;
22 printf("[nada]%c\n", teste.ch);
23 printf("%d\n", teste.i);
25 printf("\n--> union: %d struct: %d\n", sizeof(teste), sizeof(teste2));
27 return 0;