Pointer in C language
pointer is a treated as secondary datatype which offer a high degree of flexibility in the management of data as the name employee pointer refers to address identifying a programming element like data on function Thus, the user can make operation directly on same data on function.
Memory is organized in the form of a sequence of a byte location for storage cell containing either program code on data.this byte are numbered starting form zero onward the number associated with each cell is known as it address on memory location.A pointer is an entity which contents a memory address impact a pointer is number which specify is a location a memory.
“Key point about pointer”
- Each byte in the memory each associated with a number on address.
- An address is a sequence of binary digit of fixed length which is used for labeling a byte in the memory
- Address is a positive integer starting from zero to maximum addressing capacity of microprocessor.
- Every element like data on function on program in located into memory is on program in located into memory is associated with valid range of addresses.
- The number of byte accessed by a pointer depend on the datatype of on item to which it is a pointer.
The main use of pointer
- Accessing data value from memory.
- Accessing array element
- Passing argument to function by address when modification of formal argument are to be reflected on actual argument.
- Passing array and selection to function
- Creating data structure such as link list, tree, brake,graph etc
A pointer variable can be declared just like as a normal variable with any primary data type using an strict(*) symbol.
//syntax :-datatype *<variable name>; int a,*b;
In this example a is a normal integer variable where as strict is an integer type pointer variable.
The addressing operator(&) This operator is used to obtain the address of a variable.