I’m working on the string: {()} my code searches for the first ) and replaces it and the character before it ( with whitespace and the result is { }
What i want to do instead of replacing the match to whitespaces is to remove the parentheses from the string and recursively check the string again using my existing code. I’m trying to find a way to collapse the remaining characters using memmove or something similar
char openKey[] = "({<[";
char closeKey[] = ")}>]";
pch = strpbrk(parenthesesStack, closeKey);
while (pch != NULL)
{
if (opposits(*(pch-1),*pch)){
printf("%c %c\n" , *(pch-1), *pch);
memmove(pch-1," ",2);
}
pch = strpbrk (parenthesesStack,closeKey);
}
So you want to move the rest of the string 2 positions to the left?
Try this: