摘要:        
1intstrcmp(char*str1,char*str2){2while(*str1&&*str2&&*str1==*str2){3++str1;4++str2;5}6return*str1-*str2;7}Another method: int stringcmp(char *s1,char *s2) { while(*s1||*s2) //如果S1和S2比较...    阅读全文
posted @ 2009-09-10 15:33
简简单单幸福
阅读(7435)
评论(0)
推荐(0)
        
            
        
        
摘要:        
intstrstr(char[]str,char[]par){2inti=0;3intj=0;4while(str[i]&&str[j]) {5if(str[i]==par[j]) {6++i;7++j;8} else {9i=i-j+1;10j=0;11}12}13if(!str[j]) returni-strlen(par);14elsereturn-1;15} int mai...    阅读全文
posted @ 2009-09-10 15:32
简简单单幸福
阅读(651)
评论(0)
推荐(0)
        
            
        
        
摘要:        
void reverse( char  * str) {2  char tmp;3  int len;4 len = strlen(str);5 for ( int i = 0 ;i < len / 2 ; ++ i) {6 tmp =str [i];7 str[i] = str[len - i - 1 ];8 str[len - i - 1 ] = tmp;9 } 10 }    阅读全文
posted @ 2009-09-10 15:23
简简单单幸福
阅读(108)
评论(0)
推荐(0)
        
            
        
        
摘要:        
int isLoop(Listl)  {2  if ( ! l) return  - 1 ;3 Lists = l.next;4 while (s && s != l)  {5 s = s.next;6 } 7  if ( ! s) return  - 1 ;8  else reutrn 1 ;9 } 1intisLoop(Listl){2if(!l)return0;3p=l.ne...    阅读全文
posted @ 2009-09-10 15:19
简简单单幸福
阅读(635)
评论(0)
推荐(0)
        
            
        
        
摘要:        
反转一个链表。循环算法。1Listreverse(Listl){2if(!l)returnl;3listcur=l.next;4listpre=l;5listtmp;6pre.next=null;7while(cur) {8tmp=cur;9cur=cur.next;10tmp.next=pre11pre=tmp;12}13returntmp;14}    阅读全文
posted @ 2009-09-10 14:54
简简单单幸福
阅读(463)
评论(1)
推荐(0)
        
 
                    
                     
                    
                 
                    
                
 
         浙公网安备 33010602011771号
浙公网安备 33010602011771号