1/*The logic behind the function is to copy and place the ending part of string
2along with the deliminator '\0' to the position from where you want the
3"no_of_char" number of characters removed*/
4
5void delchar(char *string,int starting_pos, int no_of_char)
6{
7 if (( starting_pos + no_of_char - 1 ) <= strlen(x) )
8 {
9 strcpy(&x[starting_pos-1],&x[starting_pos + no_of_char-1]);
10 puts(x);
11 }
12}
1#include <string.h>
2
3char *strremove(char *str, const char *sub) {
4 size_t len = strlen(sub);
5 if (len > 0) {
6 char *p = str;
7 while ((p = strstr(p, sub)) != NULL) {
8 memmove(p, p + len, strlen(p + len) + 1);
9 }
10 }
11 return str;
12}
13