Image Flip algorithm in C
A few comments:


you use signed/unsigned types inconsistently. Your width and height are
unsigned, while all other integers are signed.  If you are using unsigned
types because the values can never be negative, then the same applies to all
integers in the function and, by that reasoning, they should all be unsigned
(size_t is a common type used for sizes).  There are arithmetic errors that
can occur with mixed signed and unsigned arithmetic, so you should turn on
conversion warnings (eg -Wconversion for gcc).
your naming is inconsistent.  The function and the variable rowIndex use
"camel-case", while the other variables don't.
the return from malloc should not be cast in C (C++ requires casting).
source_offset and target_offset should be defined at the point of first
use (ie. within the loop).  There is no performance penalty for defining a
variable within a loop in C.
there is no check for success from malloc


Here is a slightly simplified version of the function

void flip_vertically(unsigned char *pixels, const size_t width, const size_t height, const size_t bytes_per_pixel)
{
    const size_t stride = width * bytes_per_pixel;
    unsigned char *row = malloc(stride);
    unsigned char *low = pixels;
    unsigned char *high = &amp;pixels[(height - 1) * stride];

    for (; low &lt; high; low += stride, high -= stride) {
        memcpy(row, low, stride);
        memcpy(low, high, stride);
        memcpy(high, row, stride);
    }
    free(row);
}


You can see that I have changed some types, shortened variable names (it is a
short function so short names are appropriate) and simplified the way buffer
offsets are calculated to just addition/subtraction.