Pointer in c language is a variable that stores the address of other variable at run time (dynamically). It can be of any primitive data type or user defined data type. Pointer enables us to access a variable that might be defined outside the function.
Thursday, February 27, 2020
Why doesn't Java have pointers?
First we need to discuss about pointer before going further.
Pointer in c language is a variable that stores the address of other variable at run time (dynamically). It can be of any primitive data type or user defined data type. Pointer enables us to access a variable that might be defined outside the function.
But there is no 'address of' (&) operator to get the address of the object as we can in c/c++.
So,
1. we can't use pointer arithmetic like things in java.
2. We can't use get the address of an object.
3. We can't move from one node to another by incrementing the pointer, as we can in c/c++
4. We can use pointer for an array and traverse the whole array via pointer increment or decrement.
Subscribe to:
Posts (Atom)