C program to remove the first occurrence of a character from string using a while a loop. | सी प्रोग्राम एक लूप का उपयोग करके स्ट्रिंग से एक चरित्र की पहली घटना को हटाने के लिए।












C program to remove the first occurrence of a character from string using a while a loop.




C program to remove the first occurrence of a character from string using a while a loop.



#include <stdio.h> #include <string.h> #define MAX 100 void removeF(char *, const char); int main() { char text[MAX]; char remove; printf("\nEnter any string: "); gets(text); printf("\n Enter character to remove from string: "); remove = getchar(); removeF(text, remove); printf("String after removing first '%c' : %s", remove, text); return 0; } void removeF(char * text, const char remove) { int i = 0; int len = strlen(text); while(i


Output:

Enter any string: c programm Enter character to remove from the string: m String after removing first' : c program



Exercise: 1
C program to remove the first occurrence of a character from string.