程序代码:
#include <stdio.h>
#define N 15 //ip字符串最大长度
int main(void)
{
int i = 0,j = 0;
char ip[N];
printf("Enter ip:\n");
scanf("%s",&ip);
while (ip[i] != '\0')
{
if (ip[i] != '.')
{
ip[j] = ip[i];
j++;
}
i++;
}
ip[j] = '\0';
printf("%s",ip);
return 0;
}