strrev(3pub)

strrev3pub

Reverse a string in place

Usage

#include <publib.h>
char *strrev(char *str);

Overview

strrev reverses the argument string in place, i.e., it swaps the ith character from the beginning with the ith character from the end.

Return value

strrev returns its argument.

Examples

Reversing "dlrow, elloh" would be done like the following.

char str[] = "dlrow, elloh";
puts(strrev(str));

This would output "hello, world". Note that using the string literal as the argument would be an error, since it is not allowable to modify string literals.

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

Bugs

Does not automatically detect palindromes, nor automatically return without doing anything.

Author

Lars Wirzenius ([email protected])

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