C Program to Remove All Occurrences of a Character in a String

C Program to Remove All Occurrences of a Character in a String, Remove All Occurrences of a Character in a String, Remove All Occurrences, basic c language, loop, string, c string


Required knowledge

Basic C Programming, Loop, String

C Program

#include < stdio.h > #include < conio.h > void main() { clrscr(); int i,j; char a[20],b; printf("Please Enter any String : "); gets(a); printf("Please Enter the Character that you want to Remove: "); b=getchar(); for(i=0;a[i]!='\0';i++) { if(a[i]==b) { for(j=i;a[j]!='\0';j++) { a[j]=a[j+1]; } } } printf("The Final String after Removing All Occurrences of '%c' = %s",b,a); getch(); }

Output

Please Enter any String : Harvindar Please Enter the Character that you want to Remove: a The Final String after Removing All Occurrences of 'a' = hrvindr

1 Comments

  1. 1xbet korean - ₹9280000 ₹200000₹4xbet lok
    1xbet korean - 샌즈카지노 ₹9280000 ₹200000 ₹200000 ₹4xbet lok. - 1xbet korean - 1xbet korean ₹9280000 ₹200000 ₹18000 바카라사이트 ₹12500.

    ReplyDelete