memrev(3pub)

memrev3pub

Reverse an array in place

Usage

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

Overview

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

Return value

memrev returns its first argument.

Examples

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 }.

Releases

16 releases since Debian 1.2 (Rex); the text changed 4 times.

  1. 1.2–1.3
  2. 2.0–2.2
  3. 3.0
  4. 3.1–6.0
  5. 7–13

Author

Lars Wirzenius ([email protected])

From publib-dev 0.40-4 in Debian 13 (Trixie). Parsed by carta from the page's man source.