I have had really big problems understand the char*
lately.
Let\'s say I made a recursive function to revert a char*
but depending on how I initial
char * bob = "hello";
This actually translated to:
const char __hello[] = "hello";
char * bob = (char*) __hello;
You can't change it, because if you'd written:
char * bob = "hello";
char * sam = "hello";
It could be translated to:
const char __hello[] = "hello";
char * bob = (char*) __hello;
char * sam = (char*) __hello;
now, when you write:
char * bob = new char[6];
bob = "hello\0";
First you assign one value to bob, then you assign a new value to it. What you really want to do here is:
char * bob = new char[6];
strcpy(bob, "hello");