zoukankan      html  css  js  c++  java
  • strncmp实现

    ;***
    ;int strncmp(first, last, count) - compare first count chars of strings
    ;
    ;Purpose:
    ;       Compares two strings for lexical order.  The comparison stops
    ;       after: (1) a difference between the strings is found, (2) the end
    ;       of the strings is reached, or (3) count characters have been
    ;       compared.
    ;
    ;       Algorithm:
    ;       int
    ;       strncmp (first, last, count)
    ;             char *first, *last;
    ;             unsigned count;
    ;             {
    ;             if (!count)
    ;                     return(0);
    ;             while (--count && *first && *first == *last)
    ;                     {
    ;                     first++;
    ;                     last++;
    ;                     }
    ;             return(*first - *last);
    ;             }
    ;
    ;Entry:
    ;       char *first, *last - strings to compare
    ;       unsigned count - maximum number of characters to compare
    ;
    ;Exit:
    ;       returns <0 if first < last
    ;       returns 0 if first == last
    ;       returns >0 if first > last
    ;
    ;Uses:
    ;
    ;Exceptions:
    ;
    ;*******************************************************************************
  • 相关阅读:
    Android中Services之异步IntentService(二)
    Android服务之Service(其一)
    JPA 2.0 中的动态类型安全查询
    JPA注解参考
    WebService netbeans glassfish
    android ContentProvider
    github
    移动端
    php
    mysql
  • 原文地址:https://www.cnblogs.com/helloweworld/p/2803867.html
Copyright © 2011-2022 走看看