I'm having an issue removing characters from a string. I have been able to identify the characters to remove and store them as a new string but I would like a code that enables me to remove the new string's characters from the original string (where I've labelled as xxxxxxxx).
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char input[120], to_del[120], new_input[120];
int a,b;
void removeString();
int main(void)
{
printf("\nEnter your sentence: ");
gets(input);
printf("\nWhere to start: ");
scanf("%d",&a);
printf("\nHow many characters to delete: ");
scanf("%d",&b);
removeString();
printf("\nNew sentence: %s\n",new_input);
return ;
}
void removeString()
{
memcpy(to_del, &input[a-1], b);
new_input [strlen(input)-b] =xxxxxxxx;
return ;
}