rendered paste body[root@alpha s7]# ./ex11.o
Hello
Hello
Reverse ---
Reverse
[root@alpha s7]# cat ex11.c
#include <stdio.h>
void reverse(char *str);
void reverse(char *str)
{
int len = strlen(str);
int fIndex = 0 ;
int lIndex = len;
char temp;
printf("%s \n",str);
while (fIndex < lIndex)
{
temp = str[fIndex];
*(str+fIndex) = *(str+lIndex);
*(str+lIndex) = temp;
printf("%s \n",str);
fIndex++;
lIndex--;
}
printf("Reverse --- %s \n",str);
}
int main()
{
char string[] = "Hello";
printf("%s \n",string);
reverse(string);
printf("Reverse %s \n",string);
return 0;
}