I have a structure in which I have a flat array that store the list of strings and the offset will track the starting position where the string is added in the array.
typedef struct
{
char element[256];
int offset;
} A;
void A_append(A* a, const char *str) {
// Concatenate on the end of element.
strcat(&a->element[a->offset], str);
// Increment the offset to the new end.
a->offset += strlen(str);
}
int main() {
A a = { .element = "" };
a.offset = 0;
char string1[] = "one";
A_append(&a, string1);
char string2[] = "two";
A_append(&a, string2);
}
Now I want to search the string "two" in the flat array and then delete the string.
Please let me know if this feasible. If yes then how?