Include By Gkos Char Reversechar Int
reverse.c
#include <stdio.h>
/* by gkos */
char *reverse(char *);
int main(){
char *string;
string = "dlrow olleh";
printf("%s\n", reverse(string));
return(0);
}
char *reverse(char *p){
char *q, *r, *s;
void *malloc();
q = p;
r = s = (char *)malloc(sizeof p);
for(;*p != 0; p++)
; /*_*/
for(--p; p != q; p--, s++)
*s = *p;
*s = *p; *++s = 0;
return(r);
}
OUTPUT:
hello world