C language - pointers in the end what is?

1, the pointer in the end what is?
(1), pointer variables differs from ordinary variable
 pointer essence is a variable, he had no essential difference with ordinary variables. Pointer full name should be called a pointer variable, referred to as a pointer.
2. Why do you need a pointer?
(1), the pointer appears to achieve indirect access. In the compilation have indirect access to, in fact, addressing the CPU indirect addressing.
(2), indirect access (indirect addressing of CPU) CPU design is decided upon, the decision of the assembly language must be able to implement indirect addressing, in turn determines the
    C language on the assembly must also realize indirect addressing.
(3), high-level language Java / C # and so there is no pointer, then how they achieve indirect access? The answer is that the language itself helps us a good package.
3, trilogy pointers:
     the definition of indicator variables (int * p),
     the associated pointer variable (p = & a // p points to make variable a) (p = (int * ) 4 // p at the memory address to make 4 that variable)
  dereferencing (* p = 555; // 555 into the variable pointed to by p)
(1), when we int * p; p defining a pointer variable, p is because local variables, so it follows general rule C language local variables (defined local
variables and not initialized, then the value is random), so in this case p is a variable stored in the random number.
(2) at this time if we dereference p, the equivalent of our visit to this random number for the address of the memory space. That can not have access to this space in the end
to do not know (the line may or may not work), so if the variable is not defined directly bind effectively address pointer dereference go, then, almost a big bug appears.
(3), the meaning is that the binding pointer: a pointer to make access to, should visit the place, de-pointer reference is an indirect access to the target variable.
 

Guess you like

Origin www.cnblogs.com/jiangtongxue/p/11357088.html