依稀记得是某个公司的面试小题目:
void erase_spaces (char *pStr)
{
char *pW = pStr;
while (*pStr != '\0')
{
if (*pStr != ' ') *pW++ = *pStr;
++pStr;
}
*pW = '\0';
}
void erase_spaces (char *pStr)
{
char *pW = pStr;
while (*pStr != '\0')
{
if (*pStr != ' ') *pW++ = *pStr;
++pStr;
}
*pW = '\0';
}
浙公网安备 33010602011771号