You get a crash because you do this:
word = "Test";
word[2] = 'w';
The first assignment changes the pointer, so it no longer points to the memory you have allocated but to a string literal. And string literals are actually read-only character arrays. And as they are read-only, your attempt of modifying the array in the second assignment will lead to undefined behavior.
The correct way is to copy the string to the memory you have allocated, which you do with the strcpy
function:
strcpy(word, "test");
Another thing with the reassigning of the pointer is that you then loose the pointer to the allocated memory, and have a memory leak. You can not call free
on the pointer either, since the memory pointed to by word
(after your original reassignment) is no longer allocated by you, which would have caused another case of undefined behavior.