编写程序,通过键盘任一输入一个字符串,然后从第一个字母开始间隔的输出该字符串,用指针完成

例如输入computer,则输出c o m p u t e r
2025-04-13 20:01:31
推荐回答(1个)
回答1:

#include
#include

int main(void)
{
char str[100];
char *p = str;
scanf("%s", str);
while(*p != 0){
printf("%c ", *p++);
}
printf("\n");
}