NVIDIA interview question

Implement memcpy.

Interview Answers

Anonymous

Jul 9, 2013

you should care about how src and dest are overlapped, and copy from left or from right.

Anonymous

May 31, 2015

void memcpy (void *dest, void *src, size_t length) { int *currSrc = src; int *currDest = dest; chat *charSrc, *chardst; size_t nTimes = length / sizeof(int) for(int i=0; i

1

Anonymous

Jul 10, 2018

void my_memcpy(void *dst, void *src, int size) { for(int i=0; i

2

Anonymous

Apr 28, 2012

void memcpy (int* dest, int* src, int length) { char* currSrc = (char*)src; char* currDest = (char*)dest; for(int i=0; i