memrev(3) reverse an array in place

SYNOPSIS


#include <publib.h>
void *memrev(void *block, size_t elsize, size_t elnum);

DESCRIPTION

memrev will reverse an array, by swapping the contents of its elements.

RETURN VALUE

memrev returns its first argument.

EXAMPLE

To reverse an integer array one might do the following.

int array[4] = { 1, 2, 3, 4 };
memrev(array, sizeof(array[0]), 4);

This will result in the array being { 4, 3, 2, 1 }.

AUTHOR

Lars Wirzenius ([email protected])