c语言问题,输入一个字符串,将指定位置的字符删除。。求解。。。感谢

如题所述

定义一个字符串数组,然后用for语句循环,找到你要删除的那个字符,删除后就退出循环。
温馨提示:答案为网友推荐,仅供参考
第1个回答  推荐于2017-12-16
#include<stdio.h>
#include<string.h>
void main()
{
char s[81];
int i,n;
printf("input a string:");
gets(s);
printf("input n:");
scanf("%d",&n);
for(i=n;i<strlen(s);i++)
s[i]=s[i+1];
printf("s=%s\n",s);
}

//运行情况:
input a string:abcdefg
input n:2
s=abdefg
请按任意键继续. . .本回答被提问者采纳
相似回答