-->

Features of Pointers

Features of Pointers
Features of Pointers
Pointers save the memory space.
Execution time with the pointer is faster because data is manipulated with the address that is direct access to memory location.
The memory is accessed efficiently with the pointers.
Pointers are used with data structures. They are useful for representing two-dimensional and multidimensional arrays.
Important operations
Declaring a pointer variable
Assigning the address of a variable to a pointer and 
Finally accessing the value at the address available in the pointer variable

Pointer Variables Declaration
The initialization of the pointer variable is same as other variables, but in the pointer variable, we have assigned the address instead of the value.
Example:
int *ptr, ele1;
ptr = &ele1;
here, we have a pointer variable and another is a simple integer variable and we have to assign the pointer variable with the address of the ‘ele1’.
That means the pointer variable ‘ptr’ now has the address of the variable ‘ele1’.
What does the pointer contain?
The pointer contains the address of the first byte of the variable

The size of the variable depends on the data type
But the size of the pointer is always constant *(2/4/6 bytes) and depends on the compiler.

Related Posts

Subscribe Our Newsletter