What is Pointer?
Pointer is a special variable that represent the address/location of the data item. It provides an alternative way to access the value of a variable.
Pointer is used only store/hold memory address of any variable.
There are some reason to why Pointer used in programs:
and the memory map of above declaration as:
n --------> location name
10 --------> value at location
65220 --------> location/address number
The important point to note in memory map that n's address in memory is a number ( in next chapter we see how it is important? ).
Related programs:
Pointer is a special variable that represent the address/location of the data item. It provides an alternative way to access the value of a variable.
Pointer is used only store/hold memory address of any variable.
There are some reason to why Pointer used in programs:
- A pointer able to access a variable that is defined outside the function.
- Pointer are more efficient in handle the data table.
- Pointers reduce the length and complexity of the program.
- Pointer increase the speed of program execution.
- The use of the Pointer array to character string, result in saving of data storage space in memory.
Pointer Notation
Let's declare a integer variable n which value is 10:
int n = 10 ;
What is this meaning? The above declaration tells the C compiler that:
- Reserve space in memory to hold the integer value i.e. 65220
- Associate the name with this memory location i.e. n
- Store the value at location i.e. 10
n --------> location name
10 --------> value at location
65220 --------> location/address number
The important point to note in memory map that n's address in memory is a number ( in next chapter we see how it is important? ).
Related programs:
No comments:
Post a Comment