A pointer is a variable that has the address values. Pointers are used to refer to the data known by their addresses. Thus, if p is a pointer type variable which has the address value of x, then * p is just the value of x.
Or example:
int x, y;
then if p is the address value of x, allocation:
y = x 100
is identical:
y =* p 100
Similarly, allocation:
x = 3
is identical:
* P = 3.
* P used in the construction above, the * shall be considered as an operator providing value UNAR memory area whose address is contained in P.
UNAR operator * has the same priority as other Unary operators in C and is associated from right to left.
If p contains the address of the memory area allocated to x, we say that p points to x. Also, if p is the starting address value of an area of memory that contains every type type, then we say that p points to type.
In connection with the concept of pointers in Romanian and other names used:
• Reference
• Events
• landmark
• address indicator
To assign an address to a pointer type variable can be used UNAR & operator. So, if you want pointers p to x (to have the address value of x), then we can use the award:
p = x &
& UNAR operator is called operator or by referencing address. UNAR * we will call operator of indirection or differentation. Last name derives from its reverse effect of the operator UNAR &. Thus, the expression:
* X &
has the same value as operand x.
Pointers and pointer type declaration
Declares a pointer to any variable, the only difference being that the name is preceded by the character *. Thus, if we want to declare the variable p used above to store the address of x, we use the statement:
int * p
Int type establishes that p contains the address of the memory locations to store data of type int. The above statement can be interpreted as follows:
* P is the content area of memory to which p points , and this content has type int.
In general, a pointer is declared by:
type * name
which means that the name is a pointer to an area of memory points containing every type of guy.
The link between pointers and arrays
Name a painting is a pointer because it is its first element address value. However there is a difference between an array name and pointer variable type. A pointer type variable is assigned values at runtime, while it is not possible to do on behalf of a picture. It always has its first element address value. Therefore it is customary to say that the name of an array is a pointer constant.
Operations with pointers
Increment and decrement operations
Operators – - can be applied to operands of type pointer. They are running other than the data that are not pointers.
Increment operator () applied to an operand of type pointer to type t, increases address which is operating value, the number of bytes needed to store every type t.
Decrement operator has a similar effect, the difference being that in this case the operand value is diminishing with the number of bytes needed to store every type to which points operating.
Addition and Subtraction of a whole from a pointer
If p is a pointer to type t and an integer n, then we may use expressions
p n and p-n.
Pn expression has value p value increased with the product r * n, where by r we noted the number of bytes needed to store every type t. The expression pn is p value minus the product r * n.
Comparison of two pointers
Two pointers to the elements which points same picture can be compared using relational operators and equality. Thus, if p points to element t [s] and q for element t [j] same picture of t, then the expressions: p <q, p <= q, p> = q, p> q, p = = q p! = q has equal. For example, expression of p <q is set to true if i <j and false otherwise.

Dynamic memory allocation
C language allows the user to allocate data both on the stack (automatic data) and non-memory area stack (global or static data). Data on the stack allocation is made at runtime and it is not permanent. Thus, the declaration: type name, is used in a function body, then the variable name is allocated on the stack at each call of that function. When you return from office, the stack is cleaned and this variable name is not allocated. An allocation of this type of memory is called dynamic.
Global or static data, memory is allocated in the previous phases execution and allocation remains valid until the end of program execution. Therefore, such data is said that the allocation is static (not dynamic).
C language allows to dynamically allocate memory and other than as indicated above for automatic data. This is done in a special storage area, separate from the stack. This area of memory called heap memory (heap memory, heap, accumulation). It can be operated with standard features.



