浙江省高等学校教师教育理论培训

微信搜索“毛凌志岗前心得”小程序

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

#include <stdio.h>
#include <ctype.h>
int strip(char a[])
{
    char *p1,*p2;
    p1 = p2 = a;
    while(isspace(*p2))
    {
        p2++;
    }
    while((*p2)!='\0')
    {
        *p1++=*p2++;
    }
    while(isspace(*(p2-1)))
    {
        p2--;
    }
    *p2='\0';
    return strlen(a);
}


int main()
{
    char a[]="  welcome   ";
    strip(a);
    printf("==>%s<===\n",a);
    return 0;
}

posted on 2013-03-11 23:14  lexus  阅读(148)  评论(0编辑  收藏  举报