pointers are not strings. They're pointers. You have to make your pointer actually point to something before you can put string data there. As it is now, your pointer points to random memory and therefore you are attempting to write string data to random memory (BAD -- might cause program to crash or other weird behavior)
@jmyrrie
1. Let´s say I want the user to enter a name :
How do I save that name in a char* ? (like using pointers)
1 2
char* name;
cin >> name
You will get abnormal termination of the program because you did not allocate memory where you are going to read a character array.
@jmyrrie
2. If I have a function like this one:
1 2 3
void thing(*char name){
}
And now, I call that function:
thing("Hello");
Is that ok? I mean, sending " Hello".
You will get a compilation error because this declaration of the parameter *char name is invalid. The correct declaration of the parameter will look the following way
1 2 3 4 5 6 7 8
void thing( constchar *name){
}
int main()
{
thing("Hello");
}
@jmyrrie
3. And the last one, how do I initialize char* name, to hold the following "Tacos tacos"?