repo.or.cz
/
lcapit-junk-code.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Introduce examples dir
[lcapit-junk-code.git]
/
examples
/
C
/
union.c
blob
fbf05698cef9e9f8a0259fade2daae6cfa96e988
1
#include <stdio.h>
2
3
union
teste
{
4
char
ch
;
5
int
i
;
6
};
7
8
struct
teste2
{
9
char
ch
;
10
int
i
;
11
};
12
13
int
main
(
void
)
14
{
15
union
teste teste
;
16
struct
teste2 teste2
;
17
18
teste
.
ch
=
'c'
;
19
printf
(
"%c
\n
"
,
teste
.
ch
);
20
21
teste
.
i
=
666
;
22
printf
(
"[nada]%c
\n
"
,
teste
.
ch
);
23
printf
(
"%d
\n
"
,
teste
.
i
);
24
25
printf
(
"
\n
--> union: %d struct: %d
\n
"
,
sizeof
(
teste
),
sizeof
(
teste2
));
26
27
return
0
;
28
}