#include <stdio.h>
#include <string.h>
char *string_reverse(char *dst, const char *src)
{
if (src == NULL) return NULL;
const char *src_start = src;
char *dst_end
= dst
+ strlen(src
); *dst_end = '\0';
while ((*--dst_end = *src_start++)) {
;
}
return dst;
}
int main(void) {
char str[20] = "Hello World";
char dst[20];
puts(string_reverse
(dst
, str
));
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdHJpbmcuaD4KCmNoYXIgKnN0cmluZ19yZXZlcnNlKGNoYXIgKmRzdCwgY29uc3QgY2hhciAqc3JjKQp7CiAgICBpZiAoc3JjID09IE5VTEwpIHJldHVybiBOVUxMOwoKICAgIGNvbnN0IGNoYXIgKnNyY19zdGFydCA9IHNyYzsKICAgIGNoYXIgKmRzdF9lbmQgPSBkc3QgKyBzdHJsZW4oc3JjKTsKICAgICpkc3RfZW5kID0gJ1wwJzsKCiAgICB3aGlsZSAoKCotLWRzdF9lbmQgPSAqc3JjX3N0YXJ0KyspKSB7CiAgICAgICAgOwogICAgfQogICAgCiAgICByZXR1cm4gZHN0Owp9CgoKaW50IG1haW4odm9pZCkgewoKCWNoYXIgc3RyWzIwXSA9ICJIZWxsbyBXb3JsZCI7CgljaGFyIGRzdFsyMF07CglwdXRzKHN0cmluZ19yZXZlcnNlKGRzdCwgc3RyKSk7CgoJcmV0dXJuIDA7Cn0K