Quote:
Originally Posted by Fall Back Son
In any case, assigning integer expressions to pointer variables is an illegal operation.
|
Ahh okay. My whole reason for asking this was trying to understand pointers. I'm not using it for a real application. Why is it okay to do the same thing with a character pointer but not an integer? I understand that in this example the string is an array of characters and that "s" by itself is a pointer to where the string starts, but why wouldn't "i" be the memory address of where 10 was created?
char *s = "Hello World!"; // legal
int *i = 10; // illegal, but why?