Incomplete Declarations

From RAD Studio
Jump to: navigation, search

Go Up to Structures Index

Incomplete declarations are also known as forward declarations.

A pointer to a structure type A can legally appear in the declaration of another structure B before A has been declared:

struct A;                  // incomplete
struct B { struct A *pa };
struct A { struct B *pb };

The first appearance of A is called incomplete because there is no definition for it at that point. An incomplete declaration is allowed here, because the definition of B doesn't need the size of A.