SIMPLE SOLUTIONS

REVERSE(3) - Linux man page online | Library functions

Reverse a list of chained elements.

Chapter
October 1, 1997
REVERSE(3) MBK UTILITY FUNCTIONS REVERSE(3)

NAME

reverse - reverse a list of chained elements

SYNOPSYS

#include "mut.h" chain_list ∗reverse(ptold) chain_list ∗ptold;

PARAMETER

ptold Pointer to a chain_list to be reversed

DESCRIPTION

The reverse function allows to reverse the order of the elements of a chain_list. It means that the last element becomes the first one, the one before the last one the second one, and so on. remark : all mbk structures have for first field the NEXT field, so, with appropriate cast, one can reverse any mbk list. Let's notice that nothing in the C language descrip‐ tion demands a structure to be defined in memory the same way its members are defined in C. But all compiler do it this way now a day. Let's hope it will con‐ tinue!

RETURN VALUE

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

EXAMPLE

#include "mut.h" void reverse_con(p) lofig_list ∗p; { p->LOCON = (locon_list ∗)reverse((chain_list ∗)p->LOCON); }

SEE ALSO

mbk(1), chain(3).
ASIM/LIP6 October 1, 1997 REVERSE(3)
This manual Reference Other manuals
reverse(3) referred by unflattenlofig(3)
refer to chain(3)
Download raw manual
Main page MBK UTILITY FUNCTIONS (+39) ASIM/LIP6 (+480) № 3 (+68044)
Go top