strchr 字符c在字符串中出现的位置 实现

;***

;char *strchr(string, chr) - search a string for a character

;

;Purpose:

;       Searches a string for a given character, which may be the

;       null character '\0'.

;

;       Algorithm:

;       char *

;       strchr (string, chr)

;       char *string, chr;

;       {

;         while (*string && *string != chr)

;             string++;

;         if (*string == chr)

;             return(string);

;         return((char *)0);

;       }

;

;Entry:

;       char *string - string to search in

;       char chr     - character to search for

;

;Exit:

;       returns pointer to the first occurence of c in string

;       returns NULL if chr does not occur in string

;

;Uses:

;

;Exceptions:

;

;*******************************************************************************

你可能感兴趣的:(字符串)