• 2013=字符串





    #include <stdio.h> #include <stdlib.h> #define ERROR -1 #define OK 1 typedef struct { char *ch; int length; } heapstring; typedef struct { char item[100][80]; int last; }wordlisttype; typedef int status; status init(heapstring &t) { t.ch=(char *)malloc(sizeof(char)); return 1; } status strassign(heapstring &t,char *chars) { int i,j; char *c; init(t); if (t.ch) free(t.ch); for (i=0,c=chars; *c; ++i,++c) if (!i) { t.ch=NULL; t.length =0; } else if (!(t.ch=(char *)malloc(i*sizeof(char)))) return ERROR; else { for (j=0;j<i;j++) t.ch[j]=chars[j]; t.length =i; } return OK; } void outputstring(heapstring t) { int i; for (i=0;i<t.length ;i++) printf("%c",t.ch[i]); } status extractword(heapstring t,wordlisttype &wd) { int num=0,i=0,len=t.length ,label=-1,j=0; char p,q; p=' '; q=t.ch[i]; while (i<len) { if (p==' '&&q!=' ') num++; p=q; q=t.ch[i]; i++; } printf(" number=%d ",num); return 1; } main() { heapstring str; char *ch=" 1001 this is hhg a ff book!----- "; wordlisttype wd; strassign(str,ch); outputstring(str); extractword(str,wd); }

      

  • 相关阅读:
    mysql优化
    查询优化
    MySql服务器逻辑架构
    存储过程和存储函数区别
    mysql表设计原则
    mysql事务
    操作系统内存管理
    mysql索引介绍
    InnoDB与Myisam的区别
    【SVN】关于钩子的一些使用
  • 原文地址:https://www.cnblogs.com/wc1903036673/p/3407433.html
Copyright © 2020-2023  润新知