string concatenation, the hard way

Greetings people of cplusplus.com, I am working on a task wherein I am required to create my own strcat function, using the same function prototype as the c library function:
char * strcat ( char * destination, const char * source );

I have already been able to solve this problem using array subscripting, but for this task I am also required to solve the problem using pointer arithmetic.

I am not so sure how to go about doing this, and it is difficult to find any examples to learn from for this particular problem, since most people would naturally use the built-in function rather than make their own.

Any tips or suggestions for concatenating two strings using pointer arithmetic?
destination[i] is the same as *(destination+i). Voila! Pointer arithmetic.
Thank you very much, this is exactly what I needed... not sure why it didn't look so simple untill now XD
Last edited on
Topic archived. No new replies allowed.