Rev 145 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 145 | Rev 215 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | int strncmp(const char* string1, const char* string2, int count) |
1 | int strncmp(const char* string1, const char* string2, int count) |
2 | { |
2 | { |
3 | while(count>0) |
3 | while(count>0 && *string1==*string2) |
4 | { |
4 | { |
5 | if (*string1<*string2) |
- | |
6 | return -1; |
- | |
7 | if (*string1>*string2) |
5 | if (*string1) return 0; |
8 | return 1; |
6 | ++string1; |
9 | if (*string1=='\0') |
- | |
10 | return 0; |
7 | ++string2; |
11 | count--; |
8 | --count; |
12 | } |
9 | } |
- | 10 | if(count) return (*string1 - *string2); |
|
13 | return 0; |
11 | return 0; |
14 | }*string2) |
12 | } |