Here is an implementation of strCopy
void strcopy2(char *dst, char const *src){
while ((*dst++ = *src++))
;
}
Our professor asked us to reproduce this code without using pointers, so I came up with the following function:
void strcopy(char dst[], char const src[]){
size_t i = 0;
while (dst[i] = src[i++])
;
}
It works well, but I realised, that under the hood the function must still be using pointers, as we nowhere return any value. In other words, I though the last function would use pass by value but this is obviously not the case. So what is happening under water, and is there actually any difference between the two methods?