너무 기초적인 질문일지 싶습니다.
말그대로입니다.
[code:1]
#include <stdio.h>
#include <string.h>
#include <stdclib.h>
char *re_str(char *ptr);
int main() {
char *p;
p="We are the world !!!";
printf("%s\n",re_str(p));
return 0;
}
char *re_str(char *ptr) {
char *rev;
int i,j;
i=strlen(ptr)-1;
j=0;
rev=(char *)malloc(strlen(ptr));
for ( ; i>=0; i--) {
rev[j]=*(ptr+i);