APPFS
Advanced practical programming for scientists
Main Page
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
ex4_union.c
Go to the documentation of this file.
1
#include <stdio.h>
2
#include <stddef.h>
3
4
typedef
union
{
char
c
;
int
i
;
double
d
;
short
s[4]; }
CIDS
;
5
6
static
CIDS
cids
= { .
d
= 12.4 };
7
8
int
main
()
9
{
10
11
printf(
"size cids=%lu\n"
,
sizeof
(cids));
12
printf(
"offset d=%lu\n"
, offsetof(
CIDS
,
d
));
13
printf(
"d=%f\n"
, cids.
d
);
14
printf(
"c=%d\n"
, cids.
c
);
15
printf(
"i=%d\n"
, cids.
i
);
16
}
CIDS::d
double d
Definition:
ex4_union.c:4
c
char c
Definition:
ex4_struct.c:4
d
double d
Definition:
ex4_struct.c:4
CIDS::i
int i
Definition:
ex4_union.c:4
cids
static CIDS cids
Definition:
ex4_union.c:6
CIDS::c
char c
Definition:
ex4_union.c:4
i
int i
Definition:
ex4_struct.c:4
CIDS
Definition:
ex4_union.c:4
main
int main()
Definition:
ex4_union.c:8
Generated on Sun Nov 16 2014 23:14:05 for APPFS by
1.8.6