1 #include <stdio.h>
 2 
 3 int charCount(char *str)
 4 {
 5     int iCount = 0;
 6     int i, j, k=0;
 7     char *p = str;
 8     char *q = p;
 9     while (*p)
10     {
11         p++;
12         k++;
13     }
14     for (i=0; i<128; i++)
15     {
16         str = q;
17         for (j=0; j<k; j++)
18         {
19             if (i == *str)
20             {
21                 iCount++;
22                 break;
23             }
24             str++;
25         }
26     }
27     return iCount;
28 }
29 
30 int main()
31 {
32     char *p = "   abcdeef121";
33     printf("%d\n", charCount(p));
34     return 0;
35 }
posted on 2015-12-18 01:01  chifandeyu  阅读(1168)  评论(0编辑  收藏  举报