mikroC
making it simple...
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 comma-delimited sequence of values with-
in braces, similar to array. Referring to declarations from the previous example:
/* Declare and initialize dots p and q: */
struct Dot p = {1., 1.}, q = {3.7, -0.5};
/* Initialize already declared circles o1 and o2: */
o1 = {1, {0, 0}};
o2 = {4, { 1.2, -3 }};
Incomplete Declarations
Incomplete declarations are also known as forward declarations. A pointer to a
structure type
has been declared:
A
struct A;
struct B {struct A *pa;};
struct A {struct B *pb;};
The first appearance of
at that point. An incomplete declaration is allowed here, because the definition of
doesn't need the size of
B
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 comma-delimited
be of the given structure type (or derived from it), but you cannot declare addition-
al objects of this type elsewhere.
It is possible to create a typedef while declaring a structure, with or without a tag:
typedef struct { ... } Mystruct;
Mystruct s, *ps, arrs[10];
MikroElektronika: Development tools - Books - Compilers
mikroC - C Compiler for Microchip PIC microcontrollers
// r is 1, center is at (0, 0)
// r is 4, center is at (1.2, -3)
can legally appear in the declaration of another structure
A
// incomplete
is called incomplete because there is no definition for it
A
.
A
before
B
to
struct-id-list
page
75
Need help?
Do you have a question about the PIC Microcontrollers PIC12 and is the answer not in the manual?