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












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




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



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


Output:

Enter any string: I love computer language Enter character to remove from a string: o String after removing last 'o': I love cmputer language



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