First of all, grammatically speaking, both are correct.
In fact, the basis for judgment is very simple. As long as the data types on both sides of the assignment number are the same, there is no syntax error.
The type of pb is int*, and the type of X is int.
The & operator means the address with the right value, and the * operator means the value of the content pointed by the address with the right value. The two can be said to be reciprocal operations, equivalent to+and-.
Pb = & ampx, and the types on both sides are int * = &;; (int)-& gt; int* = int*
*pb=x, and the types on both sides are * (int *) = int-> int = int.
So grammatically, both are correct.
However, for a single statement, only the former can run, and the latter can run under certain conditions, provided that it has been assigned a value.
First of all, both int* and char* are memory addresses, and addresses are integers, such as 32-bit unsigned integers in most systems.
The reason why the assignment number runs incorrectly is that there is no right value of the assignment number, that is to say, the right value of the assignment number must have a value before assignment can be made.
So, for PD = &;; X, because after X is declared, it immediately opens up a space in the memory, so pd can assign X's address.
For *pb=x, this assignment operation can only be performed when X is declared, otherwise there is no value on the right side of the assignment number, and an error is reported.