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

memrev - reverse an array in place

Author

       Lars Wirzenius (lars.wirzenius@helsinki.fi)

Publib                                        C Programmer's Manual                                 MEMREV(3pub)

Description

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

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

Name

       memrev - reverse an array in place

Return Value

memrev returns its first argument.

See Also

publib(3), strrev(3), memshuffle(3)

Synopsis

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

See Also