What is the difference in pointers when defining char and int?

Viewed 2669

I understand the basics of how pointers work, but the following example confuses me.

int *myNum = 10; // Produces an error

char *myChar = "Something"; // Works fine

Why does assigning char work but integer doesn't (Maybe cause char is treated as an array)?

As well what confuses me when directly assigning a pointer variable, does it automatically get an address?

char *myChar = "Something";

and

char myChar = "Something";
char *charAddr = &myChar;

What would be the difference here, or equals?

5 Answers
Related