What you've actually done is technically incorrect, but there is a way to do it safely.
addBits declares an array of two items and writes three items into it.
deleteBits overwrites the array of two items with an array of one item, then overwrites that too.
The '2' means a size of 2, so indices [0, 1], so yes you need to allocate with size '1 + max index'. The first problem that jumps out at me is: z.field[0].text = "Something1";
You aren't copying the string 'Something1' into text, you are storing a pointer to that string, which isn't guaranteed to be valid after the expression in which it is initialized. What you want is:
1 2 3
z.field[0].text = newchar [strlen("Something1") + 1]; // +1 for the NULL
strcpy(z.field[0].text, "Something1");
// repeat
Then, you will need to delete text at some point as well, of course. Note this is the C-style way of doing things - you can use "std::string" to make life easier, if you want.
When you say it doesn't work. Do you mean that the above code doesn't work after you fixed it or that your other project that we have never seen doesn't work?
My other project... so it's probably time to move the focus from this code to my old code... but it's too big to upload. Not THAT big just too big for a forum post (23kb).
It's a simple bit of code really... should only take a second to see the issue(s) if someone actually knows C++ (unlike me, it would seem)