zoukankan      html  css  js  c++  java
  • 将一个句子中的单词翻转

    /*将一个句子中的单词翻转*/
    #include <stdio.h>

    char* strrevw(char* string){
       
    char* s=string;
       
    char* e=s;
       
    char  ch;
       
    char *ws,*we;
       
    while(1){
           
    if(*e==' ' || *e=='\0'){
               
    ws=s;
               
    we=e-1;            
               
    while(ws<we){
                   
    ch=*ws;
                    *
    ws++=*we;
                    *
    we--=ch;
                }
               
    if(*e=='\0')
                   
    break;
               
    s=e;
               
    while(*++s==' ');
            }
           
    e++;
        }
       
    return string;    
    }

    int main(){
       
    char a[]="123  1234   12345";

       
    printf("%s\n",a);
       
    printf("%s\n",strrevw(a));
       
    return 0;
    }
  • 相关阅读:
    超媒体
    超文本
    视频文件格式
    web.py 模板错误记录
    pip常用记录
    微信公众号绑定服务器 Flask版
    scrapy 简单防封
    python 手写队列
    jQuery个人总结
    PHP用url传递数组
  • 原文地址:https://www.cnblogs.com/iwasmu/p/1491810.html
Copyright © 2011-2022 走看看