Continuous array
#define s (s) Printf ("% s / n", #s); s
Typedef struct_ts1 {
INT X, Y;
} TS1, * PTS1, *** PPPTS1; // TS1 is the name of the structure, PTS1 is the name of the structural pointer
// That is, named the structural struct _ts1 to TS1,
// Naming struct_ts1 * PTS1
// Name the struct_ts1 *** PPPTS1
TypedEf struct {// struct instructions can also be removed
INT X, Y;
} TS2, * PTS2;
TypedEf PTS1 * PPTS1; // Defining PPTS1 is a pointer to PTS1
Typedef struct _tts1 {
TypedEf struct itts1 {
INT X, Y;
} inher;
INER i;
INT X, Y;
} TTS1;
// The structure inside the structure can be defined
Typedef TTS1 :: ITTS1 ITS1;
void test_struct ()
{
// Basic structural weight definition
TS1 TS1 = {100, 200};
PTS1 PTS1 = & TS1; // Complete equivalent to TS1 * PTS1 = & TS1;
PPTS1 PPTS1 = & PTS1; // Complete equivalent to TS1 ** PPTS1 = & PTS1;
PPPTS1 PPPTS1 = & PPTS1; // Completely equivalent to TS1 *** PPPTS1 = & PPTS1;
TS2 TS2 = {99, 88};
PTS2 PTS2 = & TS2; // Complete equivalent to TS2 * PTS2 = & TS2;
TTS1 ITTS1 = {{110, 220}, 10, 20};
ITS1 * RITS1 = & itts1.i;
ITS1 * & its1 = rits1; // Equivalent to TTS1 :: ITTS1 * ITS1 = & (ITTS1.I);
Printf ("TS1 / T = (% D,% D) / N * PTS1 / T = (% D,% D) / N"
"** PPTS1 / T = (% D,% D) / n *** PPPTS1 = (% D,% D) / N / N",
Ts1.x, ts1.y, pts1-> x, pts1-> y,
(** pPTS1) .x, (** pPTS1) .y, (*** pppts1) .x, (*** pppts1) .y);
Printf ("TS2 / T = (% D,% D) / N * PTS2 / T = (% D,% D) / N / N",
Ts2.x, Ts2.y, PTS2-> X, PTS2-> Y);
Printf ("ITTS1 / T = [(% D,% D),% D,% D] / N * ITS1 / T = (% D,% D) / N / N",
ITTS1.I.X, ITTS1.I.Y, ITTS1.X, ITTS1.Y, ITS1-> X, ITS1-> Y);
S (PTS1-> x = 119);
S (PTS2-> y = 911);
S (ITS1-> x = 999);
Printf ("TS1 / T = (% D,% D) / N * PTS1 / T = (% D,% D) / N"
"** PPTS1 / T = (% D,% D) / n *** PPPTS1 = (% D,% D) / N / N",
Ts1.x, ts1.y, pts1-> x, pts1-> y,
(** pPTS1) .x, (** pPTS1) .y, (*** pppts1) .x, (*** pppts1) .y); printf ("TS2 / T = (% D,% D) / N * PTS2 / T = (% D,% D) / N / N ",
Ts2.x, Ts2.y, PTS2-> X, PTS2-> Y);
Printf ("ITTS1 / T = [(% D,% D),% D,% D] / N * ITS1 / T = (% D,% D) / N / N",
ITTS1.I.X, ITTS1.I.Y, ITTS1.X, ITTS1.Y, ITS1-> X, ITS1-> Y);
S ((* pPTS1) -> y = -9999);
Printf ("TS1 / T = (% D,% D) / N ** PPTS1 / T = (% D,% D) / N / N",
Ts1.x, ts1.y, (* pPTS1) -> x, (* pPTS1) -> Y);
S ((** PPPPTS1) -> x = -12345);
S ((*** pppts1) .y = -67890);
Printf ("TS1 / T = (% D,% D) / N * PTS1 / T = (% D,% D) / N"
"** PPTS1 / T = (% D,% D) / n *** PPPTS1 = (% D,% D) / N / N",
Ts1.x, ts1.y, pts1-> x, pts1-> y,
(** pPTS1) .x, (** pPTS1) .y, (*** pppts1) .x, (*** pppts1) .y);
}