1REVERSE(3)                   MBK UTILITY FUNCTIONS                  REVERSE(3)
2
3
4

NAME

6       reverse - reverse a list of chained elements
7

SYNOPSIS

9       #include "mut.h"
10       chain_list ∗reverse(ptold)
11       chain_list ∗ptold;
12

PARAMETER

14       ptold               Pointer to a chain_list to be reversed
15

DESCRIPTION

17       The  reverse  function allows to reverse the order of the elements of a
18       chain_list. It means that the last element becomes the first  one,  the
19       one before the last one the second one, and so on.
20
21       remark :
22              all mbk structures have for first field the NEXT field, so, with
23              appropriate cast, one can reverse any  mbk  list.  Let's  notice
24              that  nothing  in the C language description demands a structure
25              to be defined in memory the same way its members are defined  in
26              C.  But  all  compiler  do it this way now a day.  Let's hope it
27              will continue!
28

RETURN VALUE

30       reverse returns a pointer to the head of the reversed list.
31

EXAMPLE

33       #include "mut.h"
34       void reverse_con(p)
35       lofig_list ∗p;
36       {
37          p->LOCON = (locon_list ∗)reverse((chain_list ∗)p->LOCON);
38       }
39

SEE ALSO

41       mbk(1), chain(3).
42
43
44
45
46
47
48ASIM/LIP6                       October 1, 1997                     REVERSE(3)
Impressum