あまり詳しくなくてよくわからんのですが、
>>334は
int i = 0;
while(~(TempString[i] = ~TempString[i++]));
TempString[i] = '\0';
return TempString;

こんな感じならいいの?