I want to create a function that reverses a C-string.
It does not return the C-string to me. But the address of sortante is indeed the beginning of my chain terminated by a terminal 0.
#include <stdio.h>
#include <stdlib.h>
const char txt[] = "salut";
char *inverser(const char *entrante);
int main()
{
    puts(inverser(txt));
    return 0;
}
char *inverser(const char *entrante)
{
    static char sortante[9];
    const char *i; char *o;
    i = entrante; o = sortante;
    while (*i++);
    i--;
    while (i >= entrante)
        *o++ = *i--;
    *o = '\0';
    return sortante;
}
When I run this code on codeblocks I get nothing as output.
I think I can reverse my C-string "salut", which should have displayed "tulas".
 
    