Preview:
#include <stdio.h>
#include <string.h>

void reverse_string_recursive(char *str) {
    if (*str == '\0') {
        return;
    }
    reverse_string_recursive(str + 1);
    printf("%c", *str);
}

int main() {
    char input_string[] = "hello world";
    printf("Original string: %s\n", input_string);
    printf("Reversed string: ");
    reverse_string_recursive(input_string);
    printf("\n");
    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