Structures

Structures are like variables that the programmer defines. They work the same as other variables like int and float.

Definition
You define a struct by the following syntax. It will be placed either in the root of a .c document or inside a header file (.h):

typedef struct StructName { //any variables int pi; };

Example:

typedef struct potato { int size; int weight; char color; };

Declaration
StructName variablename;

Example:

potato pt;

Accessing Members
Each variable inside the struct is accessible for each variable. Each time you declare a new struct, it will have each variable as its member. It can be accessed by entering:

VariableName.Mamber

You can change each member exclusively, even from other structs.

Full Example
typedef struct Window { int width,height; bool fullscreen; D3DCOLOR background; }; int main {     Window wnd1,wnd2; wnd1.width = 10; wnd1.height = 15; wnd1.fullscreen = false; wnd1.background = D3DCOLOR_XRGB(0,0,0); wnd2.width = 15; //wnd1.width will not change //etc... }