Question.5
A developer writes a generic buffer copy function:
void copy(void *dst, void *src, int n) { for (int i = 0; i < n; i++) dst[i] = src[i]; }
Will this compile and work correctly?
Select Answer
Yes — void* can be indexed like any pointer
void*
No — void* has no known element size, so indexing and dereferencing are invalid
No — but only because of missing const on src