Preview:
#include <stdio.h>

int _strlen(char *str)
{
    int len, i;

    len = 0;
    for (i = 0; str[i]; i++)
        len++;
    return (len);
}

void reverse_string(char *str)
{
    int i, j, size;
    size = _strlen(str);

    j = 0;
    for (i = size - 1; i > j; i--)
    {
        char temp = str[j];
        str[j] = str[i];
        str[i] = temp;
        j++;
    }
}

int main(void)
{
    char str[] = "JQK";
    reverse_string(str);

    printf("Reversed string: %s\n", str);

    return 0;
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter