#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void hashMap(const char *p)
{
if(NULL == p)
{
perror("the p is null\n");
return ;
}
int size = 256;
int hash[size];
bzero(hash,size);
char *q = (char *)malloc(128);
if(NULL == q)
{
perror("malloc error\n");
return ;
}
strncpy(q,p,strlen(p));
printf("the strncmp is %s\n",q);
while(*p != '\0')
{
char ch = *p;
printf("the ch is %c\n",ch);
p++;
++hash[ch];
}
while(*q != '\0')
{
char buf = *q;
printf("the buf is %c and the num is %d\n",buf,hash[buf]);
q++;
if(hash[buf] == 1)
{
printf("the first is %d the is %c\n",hash[buf],buf);
break;
}
return;
}
}
int main()
{
char *p = "you is are very good ";
hashMap(p);
return 0;
}