Pointers
They pass the reference to value rather than the value itself, this helps to passing a copy of the value rather than the value itself.
Important:
& : to get memory address of value * : to extract value from memory address (if not assigned to a value) but if its variable with * is assigned to a value, this is called dereference
In a programming language, pass by value and pass by reference are two general argument passing method. The difference is that, pass by value is passing a copy of variable or value while pass by reference is passing the reference to memory address where the value resides. This means, any variable that is referenced to the shared memory space will alter the value and the effect will be visible in all variables that references the address.
There are various example where you can use Pointers:
You will need to use Pointer when developing banking application that brings change in account balance when you add / remove amount
You will need both with and without Pointer in performing transaction (a transaction involves simulataneous credit and debit from two different accounts)
Last updated
Was this helpful?