() , . .
:
, ( , ) info , (Prev) (Next) :
struct Spis {
int info;
Spis *Prev, *Next;
};
Spis * begin, * end; .
. , .
1. :
Spis *t = (Spis*) malloc (sizeof(Spis));
:
2. :
) , , :
scanf(%d, &t -> info); cin >> t -> info;
) ( NULL):
t -> Prev = t -> Next = NULL;
) :
begin = end = t;
:
1. .
2. :
t = (Spis*) malloc(sizeof(Spis));
3. :
scanf(%d, &t -> info);
4. :
) (Next) NULL, .. , t :
t -> Next = NULL;
) (Prev), (end), :
t -> Prev = end;
5. end, t, (end) ():
end -> Next = t;
6. :
end = t;
7. , .
1. : | |
t = begin; | t = end; |
2. , , t!= NULL. | |
3. t -> info . | |
4. : | |
, Next t = t -> Next; | , Prev t = t -> Prev; |
5. . |