You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
436 B
Markdown
18 lines
436 B
Markdown
# Unions
|
|
|
|
Probably won't be used much, eh.
|
|
|
|
Like a structure, but all members share the same (starting) memory address
|
|
|
|
typedef union testUnion{
|
|
int Int;
|
|
float Real;
|
|
}
|
|
|
|
A union is the size of it's biggest member (in bytes)
|
|
|
|
A union will be one of these types, so either an int or float depending on what it's set as.
|
|
|
|
|
|
This can be useful for APIs, or if a variable could be a number of types. More likely the former.
|