mikroC
making it simple...
mikroC - C Compiler for Microchip PIC microcontrollers
Note that you can omit structure tag, but then you cannot declare additional objects of this type elsewhere. For more information, see the “Untagged Structures” below.
Structure is initialized by assigning it a
/* Declare and initialize dots p and q: */ struct Dot p = {1., 1.}, q = {3.7,
/* Initialize already declared circles o1 and o2: */
o1 = {1, {0, 0}}; // r is 1, center is at (0, 0)
o2 = {4, { 1.2,
Incomplete Declarations
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.
Untagged Structures and Typedefs
If you omit the structure tag, you get an untagged structure. You can use untagged structures to declare the identifiers in the
It is possible to create a typedef while declaring a structure, with or without a tag:
typedef struct { ... } Mystruct; Mystruct s, *ps, arrs[10];
|
| page |
MikroElektronika: Development tools - Books - Compilers | 75 | |
|