1 2 3 4 5 6 7 8
|
int ind = 0;
for(int c = 0; c < length; c++){
if(c != i){
word2[ind] = word[c];
ind++;
}
}
|
you will have to toy with the indices but
memcpy(destination, source, # of bytes)
so
memcpy(word2, word, i); //I think?
it could also be length, not i, not sure.
it looks like the two for loops ended by this point, but the misaligned brackets make it really hard to tell. if that is true:
technically i has no valid value, because it should have been scoped to each loop (which is extra weird that you use i for both loops, but the outer one does nothing, so that is worth saying what you think it does..) anyway, i has no value here in strict c++. Its probably length, on old compilers that tolerate using it.
if its not true, I still don't know if its i or length or even c for the memcpy.
I don't mean to be mean or rude but its a little convoluted.