I get a segfault when I run the following. Seems to fail at strcpy.
#include <cstring>
using std::strcpy;
int main()
{
char * word = "word";
strcpy(word, "what");
}
If I change char * word to char word[], it's fine. I thought that both declarations effectively do the same thing. What am I missing?
Thanks in advance.
EDIT: using c++ btw, but practicing using c style strings for the moment.