cpycstr

closed account (jvqpDjzh)
Why does this work?

1
2
3
4
5
6
7
8
9
10
char* cpycstr(char* to, const char* from)
{
    while(*to++ = *from++);//it seems that to is resized, without having to reallocate
    return to;
}

char a[0];
const char* cptr = "Hello World!";
cpycstr(a, cptr);
std::cout << a ;
Last edited on
It doesn't work.

You are free to corrupt random memory locations just to see how hard a crash you will get.
Topic archived. No new replies allowed.