int memCopy(void* , void*, int size)
Hi,
I am having some fun these days trying to implement c functions using pointers and c prototypes. So far i got strlength and stringCopy done. However i am moving along to memcopy and have to admit that i lack some knowlegde or pointers here. The following is what i started out with. I have been going back and forth a while now. Can someone explain how the memcpy function is implemented in c. Or do they use bit manipulation etc.
I know the below is wrong, but i backed up to the start of me mucking around with it.
Code:
int memCopy(void *destination, void *source, int size){
char *dest = (char*)&destination;
char *sour = (char*)&source;
int c;
for(c=0;c<size;c++)
*dest++ = *sour++;
return c;
}
Cheers,
G'n'R