logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

strrev - reverse a string in place

Author

       Lars Wirzenius (lars.wirzenius@helsinki.fi)

Publib                                        C Programmer's Manual                                 STRREV(3pub)

Bugs

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

Description

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

Example

       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.

Name

       strrev - reverse a string in place

Return Value

strrev returns its argument.

See Also

publib(3), memrev(3)

Synopsis

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

See Also