Same Asterisk Different Meanings
suggest changePremise
Pointer syntax is confusing because the asterisk (*) means two different things, besides multiplication, depending on where it appears.
Example
Use * to declare a pointer variable.
int i = 5;
/* 'p' is a pointer to an integer, initialized as NULL */
int *p = NULL;
/* '&i' is the address of 'i', which is then assigned to 'p' */
p = &i;
/* 'p' is now holding the address of 'i' */
When you are not declaring a pointer (and not multiplying), * dereferences a pointer variable:
*p = 123;
/* 'p' was pointing to 'i', so this changes value of 'i' to 123 */
When an existing pointer variable should hold the address of another object, do not use *. Assign the address to the pointer:
p = &another_variable;
A common confusion among C-programming newbies arises when they declare and initialize a pointer variable at the same time.
int *p = &i;
int i = 5; and int i; i = 5; have the same effect, but int *p = &i; is not the same as int *p; *p = &i;. The second * dereferences p. That assignment is also a constraint violation: *p has type int and &i has type int *. The form that compiles and is still wrong is int *p; *p = i;. It dereferences an uninitialized pointer, which is undefined behavior. The matching assignment is int *p; p = &i;. Do not write * unless you are declaring a pointer or dereferencing one.
Conclusion
In relation to pointers, * has two meanings. In a declaration, the initializer is a pointer value: an address. Applied to an already declared pointer, * dereferences it, so the object it points at can be read or written.
Takeaway
Be careful where the asterisk appears and which meaning it has there. Using the wrong one can fail to compile or can be undefined behavior.