What Are Pointers…
Pointer is an address, or a numeric index which is assigned to each unit of memory in the system. It can refers directly to (or "points to") another value stored elsewhere in the computer memory using its address.
- Improve performance for repetitive operations.
- pointers effectively take the place of general purpose registers.
- Allow both protected and unprotected access to memory addresses.
- much cheaper in time and space complexity.
Where Are They Used
- traversing strings, lookup tables, control tables and tree structures.
- data structures like lists, queues, trees and stack
- to hold the addresses of functions. pointers to functions often using virtual method tables
How To Solve Pointers
Pointers can be solved by referring above table.
() having highest and return type or data type having lowest priority
Pointer To Function
More On Pointer
For 16 Bit
For 32 Bit
For 64 Bit
- Referencing a pointer pointing to memory location.
- Dereferencing a pointer obtaining the value at the location a pointer refers.
- Absolute Pointer actual physical address or a virtual address.
- Relative pointer an offset from base address resolved by arithmetic operation.
- Null Pointer indicating that it refers to no object.
- Wild pointers are pointers that have not been initialized.
- auto_ptr (C++0x unique_ptr) ensures that the object to which it points gets destroyed automatically when control leaves a scope.
- hazard pointer is an element used by a method that allows the memory allocated to the nodes of lock-free dynamic shared objects to be reclaimed (HT).
- opaque pointer is a special case of opaque data type, a data type that is declared to be a pointer to data structure of some unspecified type.
- bounded pointer is a pointer that is augmented with additional information that enable the storage bounds within which it may point to be deduced
- Smart pointers typically keep track of the objects they point to for the purpose of memory management such as automatic garbage collection or bounds checking.
- segmentation fault beyond the range of available memory.
- 64 bit AMD64 where pointers are 64 bit long and addresses only extend to 48 bits, 64 GB physical address range.
- 32 bit x86 where pointers are 32 bits long and addresses only extend to 36 bit ,4 GB of physical address range.