program to remove a particular character from string
#include<stdio.h> #include<string.h> main() { char str1[50],*ptr,ch; int i,j,count=0; printf("enter string str1\n"); scanf("%[^\n]s",str1); printf("enter any character\n"); scanf(" %c",&ch); ptr=&str1[0]; while(ptr=strchr(ptr,ch)) { strcpy(ptr,ptr+1); //ptr++; } printf("%s\n",str1); }OutPut:
madan@madan-Lenovo-G570:~/madan$ cc array3.c madan@madan-Lenovo-G570:~/madan$ ./a.out enter string str1 welcome enter any character c welome