编译没有错误,但运行总是停止运行,求大佬
答案:1 悬赏:20 手机版
解决时间 2021-03-04 17:55
- 提问者网友:流星是天使的眼泪
- 2021-03-04 08:16
#include
#define N 50
void del_char(char *old, char *new1)
{ int i,j;
for(i=0;i{ if(old[i]<'A'&&old[i]>'z'&&old[i]!=0)
for(j=i;j old[j]=old[j+1];
}
for(i=0;i new1[i]=old[i];
}
void link_string(char *new1, char *link_new)
{ int i,j;
for(i=0;i<19;i++)
link_new[i]=new1[i];
for(j=19;i<38;j++)
link_new[j]=new1[i];
}
void main()
{ char *p1,*p2,*p3,new1[N]={"1"},link_new[N]={"2"},old[N]={"was it a bar or a bat saw"};
int i,j;
p1=new1;p2=link_new;p3=old;
del_char(p3, p1);
printf("%s",*p1);
link_string(p1, p2);
printf("%s",*p2);
}
最佳答案
- 五星知识达人网友:酒醒三更
- 2021-03-04 08:36
另一个提问里回答过了
一共两处错误
#include
#define N 50
void del_char(char *old, char *new1)
{
int i, j;
for (i = 0; i
{
if (old[i]<'A'&&old[i]>'z'&&old[i] != 0)
for (j = i; j
old[j] = old[j + 1];
}
for (i = 0; i
new1[i] = old[i];
}
void link_string(char *new1, char *link_new)
{
int i, j;
for (i = 0; i<19; i++)
link_new[i] = new1[i];
for (j = 19; j<38; j++)//j<38
link_new[j] = new1[i];
}
void main()
{
char *p1, *p2, *p3, new1[N] = { "1" }, link_new[N] = { "2" }, old[N] = { "was it a bar or a bat saw" };
int i, j;
p1 = new1; p2 = link_new; p3 = old;
del_char(p3, p1);
printf("%s\n", p1);//字符串,不加*
link_string(p1, p2);
printf("%s\n", p2);//字符串,不加*
}
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯