这两个程序怎么编写,急

img

逆序的方法是分别从首尾开始进行字符交换,直到中间

#include <stdio.h>
int count(char *s)
{
    int i=0,c=0;
    while(s[i++] != 0)
        c++;
    return c;
}
void revert(char *s)
{
    int len = count(s);
    int i=0,j=len-1;
    char c;
    while(i<j)
    {
        c = s[i];
        s[i] = s[j];
        s[j] = c;
    }
}
int main()
{
    char s[1000];
    gets(s);
    revert(s);
    printf("%s",s);
    return 0;
}