C Data Types - Structures

Structures

Structures are a way of storing multiple pieces of data in one variable. For example, say we wanted to store the name and birthday of a person in strings, in one variable. We could use a structure to house that data:

struct birthday { char name; int day; int month; int year; };

Structures may contain pointers to structs of its own type, which is common in linked datastructures.

A C implementation has freedom to design the memory layout of the struct, with few restrictions; one being that the memory address of the first member will be the same as the address of struct itself. Structs may be initialized or assigned to using compound literals.

Read more about this topic:  C Data Types

Famous quotes containing the word structures:

    If there are people who feel that God wants them to change the structures of society, that is something between them and their God. We must serve him in whatever way we are called. I am called to help the individual; to love each poor person. Not to deal with institutions. I am in no position to judge.
    Mother Teresa (b. 1910)

    The philosopher believes that the value of his philosophy lies in its totality, in its structure: posterity discovers it in the stones with which he built and with which other structures are subsequently built that are frequently better—and so, in the fact that that structure can be demolished and yet still possess value as material.
    Friedrich Nietzsche (1844–1900)

    The American who has been confined, in his own country, to the sight of buildings designed after foreign models, is surprised on entering York Minster or St. Peter’s at Rome, by the feeling that these structures are imitations also,—faint copies of an invisible archetype.
    Ralph Waldo Emerson (1803–1882)