Sayah,
I have been trying out you code and modified it some and more questions have popped into my head. Bear with me. I want to have a clear understanding of what is going on. Here goes.
>Never modify your caller's pointers. Always work with a copy.
Question 1
Arent we here modifying the callers pointers anyway, since the changes made to d and s affect dPtr and sPtr which are the orignal pointers
Code:
d = dPtr; /* copy original pointers */
s = sPtr;
i could only get this to work
Code:
while(blockSize--)
d++ = s++;
like this. Am i moving the address of the pointer one bit up here or actually dereferencing the pointer an asigning data or doing both?
Code:
while(blockSize--)
*d++ = *s++;
Question 3
> You're working with raw memory, so use 'unsigned' instead.
Why are unsigned variables better.
Question 4
>Use unsigned long (in the cast) instead
Is this because a long is the maximum c variable?
However, the function does work, except for i really need to insert a null terminator at the end if a pass char arrays. Is it safe to do so on any type passed to this function.
Thanks again
G'n'R