I have 20 string inside a 2D array. I must concatenate the first 20 strings by twos and leave the last 8 alone. Final would be 10 strings. I have successful concatenate the 20 but the final 8 string aren't there. Where did the final 8 string go?
I don't see anything wrong with the code you posted. Though logically... if you are halving the number of strings, you should end up with 104 strings, not 108.
No but I concatenated 200 out of 208. get 100. The 8 are left unconcatenate. But I can't find these 8. Right now. I get 104 strings because it's concatenating all the strings. If I change it to i<200. It only does the first 200 but the last 8 are missing.
Take a closer look at your while loop on line 9. That loop basically erases all strings after the ones you concatenated. So if you change the first loop to only join 200 strings, then the remaining strings will get wiped by that next loop.
Think about what you have and what you need to get done.
What you have at the start of this code:
1) dest[0] - dest[207] contain the original strings
What you have accomplished after the first for loop:
1) dest[0] - dest[99] contained joined strings
2) dest[100] - dest[207] contain the original unjoined strings
Your goal:
1) dest[0] - dest[99] contain joined strings
2) dest[100] - dest[107] contain the last 8 original, unjoined strings
3) dest[108] - dest[207] are wiped empty
So stop writing code for a second... and think about what needs to be done... logically... to move from what you have to what you need. Once you have the logic understood... then write the code to do it.
Okay I just misunderstood. You said "copy two into one" which made me think you were combining strings. But it sounds like you are just "copying one into a different one" which is the right thing to do.
So yeah... communication error. Glad it's working. :)