The asterisk is used to indicate that the variable P is a pointer, P is a variable, and its value is the address of another variable, representing an address in memory, that is, the direct address of a memory location. And *p is the value of the pointed address.
2. Different data types
When a program declares a variable, * only means "It is an unsigned integer, pointing to a memory address and accessing sizeof(type) at one time". The actual data types of all pointer values, whether integer, floating point, character or other data types, are the same, and all are long hexadecimal numbers representing memory addresses.
And *p can be integers, floating points or characters.
3. Use different methods
When programming, you can use *p directly, because p is declared as a pointer, and you need to bring * to indicate the position value when using it, such as int a, * p; *p=a .
When using p directly, p = &;; Answer.
Extended data:
Substitute * and&;
1, we need to pay attention to two places: when a program declares a variable, * only means "it is an unsigned integer, which points to a memory address, and sizeof(type access is (type)". This should not be confused with the (*) operator;
2. When the C++ program declares the variable &; Just say "it is a reference, and this reference did not open up new space when it was declared." It adds a new row to the memory allocation table, and the memory address of this row is equal to the memory address of the corresponding parameter passed in when it is called. "
3. Don't use (*), (&; ) operator confusion.
References:
Baidu encyclopedia-pointer