172.c

来自「一些常见C试题的源代码」· C语言 代码 · 共 22 行

C
22
字号
#include <stdio.h>
int func(char s[],int c)
{
    char *q=s;
    for(; *q; q++)
    if(*q != c) *(s++)=*q;
    *s='\0';
}
void main()
{
    static char str[]="Turbo c and borland c++";
    char ch;
    clrscr() ;	printf(" The string before delete is %s.\n",str);
    printf(" Please input the char to delete : ");	
    scanf("%c",&ch);
    func(str,ch);
    printf(" The string after delete is %s.\n",str);
    printf(" Press any key to quit...");
    getch();
    return;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?