Not really related to usatn at this point...OK, this is weird. I happened across a glitch in my code after this was all done...
The following code shouldn't have worked...
char *FirstAlt = new char[strlen(label[1])];
(I'd think I'd have wanted to do this instead:)
void demote(char *newPriLbl)
{ char **newLblArray = new char*[NumLabels+1];
newLblArray[0] = newPriLbl;
for (unsigned short i=0; i < NumLabels; i++)
newLblArray[i+1] = label;
label = newLblArray;
NumLabels++;
char *FirstAlt = new char[strlen(label[1])+1];
strcpy(FirstAlt, "+");
strcat(FirstAlt, label[1]);
delete label[1];
label[1] = FirstAlt;
}
...but it did work. (Was I just smashing the stack without realizing it, with no ill effects?)
From what I saw of the diffs, I saw no glitches at the end of the demoted labels (former primary labels, now the first AltLabels).
Nope. Still wrong.
The new label for FirstAlt needs to be strlen(label[1])+2 characters -- one extra character for the '+' at the beginning, and another extra character for the null-zero terminator. I made this same mistake two other places in the code.
So, I was writing past the end of my arrays all over the place.
I can't believe it worked, and without causing my computer to do goofy things.
If I were writing this now, I'd use C++ style strings...