Newer solution
I think this is closer to your requirements?
void reverse (int len, char *str )
{
char *tmp=(char*)calloc(len, sizeof(char));
const char *p=0;
while(len--)
{
p=(str+len);
strncat(tmp, p, 1);
}
strcpy(str,tmp);
free(tmp);
}
Previous solution
I tried to do without pointers, but this best I work out.
void reverse (int len, char *str )
{
char rev[100];
memset(rev,0,100*sizeof(char));
int i=len;
const char* p;
while(i)
{
p=str+i-1;
strcat(rev, p);
*(str+i-1)='\0';
i--;
}
strcpy(str,rev);
}