函数

/*squeeze函数:从字符串s中删除字符c*/
void squeeze(char s[], int c)
{
 int i, j;
 for(i = j = 0;s[i] != '';i++)
  if(s[i] != c)
   s[j++] = s[i];
 s[j] = ''; 
}

/*strcat函数:将字符串t连接到字符串s的尾部;s必须有足够大的空间*/
void strcat(char s[], char t[])
{
 int i, j;
 i=j=0;
 while(s[i] != '')
  i++;
 while((s[i++] = t[j++]) != '')
  ;
}

/*bitcount函数:统计x中值为1的二进制位数*/
int bitcount(unsigned x)
{
 int b;
 for(b = 0;x != 0;x >>= 1)
  if(x & 01)
   b++;
 return b; 
}
 
 
原文地址:https://www.cnblogs.com/TheFly/p/11850134.html