编写程序,将字符串中的“*”用空格替换掉,例如“You*are*a*teacher.”
解决方案
80
#include<stdio.h> void main(int argc, char *argv[]) { char str[64] = "You*are*a*teacher."; char *p = str; while(*p != "\0") { if(*p == "*") *p = " "; p++; } printf("%s\n", str); }
80
#include<stdio.h> void main(int argc, char *argv[]) { char str[64] = "You*are*a*teacher."; char *p = str; while(*p != "\0") { if(*p == "*") *p = " "; p++; } printf("%s\n", str); }