If I allocated a pointer using:

char *ptr = malloc(1024);

but messed around with the pointer address and such, say do this:

ptr = ptr + 20;
*ptr = *ptr + 100;

if I do free(ptr), will that work? I ask this because I did change the initial memory location that ptr was malloc(ed) with, and changed its values as well.