I have a very simple c question regarding memcopy that I have been able to fix but not understand why. The following code crashes with an "access violation" at runtuime:
char *src = "HELLO WORLD!";
char * dest = "hello world!";
memcpy(dest, src, strlen(src)+1);
dest would appear to be big enough and as I understand it memcpy should just blindly copy the bytes so I don't understand the problem.
Changing dest to an array e.g char dest[13];
fixes things, so is it a requirement that dest must be uninitialized memory and creating an array does this for you whereas the pointer declaration does not?
Cheers