Pointers are used (in the C language) in three different ways:
Pointers are also used by experienced programmers to make the code more efficient and thus faster.
So why use pointers? Why don't we use arrays to create data structures?
The answer is simple. With an array you have to declare its maximum size (for every dimension) at the beginning. Let's say you create an array that can hold a maximum of twenty megabytes. When the array is declared, the twenty megabytes is claimed. Now this time you have only data for ten megabytes.
(A next time it could be fifteen megabytes or five megabytes). So in this case ten megabytes of memory is wasted, because only ten megabytes from the twenty is used.
This is where pointers come in. With pointers, you can create dynamic data structures. Instead of claiming the memory up-front, the memory is allocated (from the heap) while the program is running. So the exact amount of memory is claimed and there is no waste. Even better, memory not used will be returned to the heap. (Freed memory can be used for other programs).
Java doesn't have pointers. C++ has pointers.
C does not have stream pointers.
They aren't. Java uses the (safer) idea of references instead of pointers.
pointers.
Nothing.
Yes, you can use pointers in the C#, but to some extent. Links are added with more details.
addresses
Accessing data via pointers.
Pointers in C are stored as integers. You can perform any mathematical operations on pointers that you can perform on ints.Of course not, the following operations are possible: =, +, +=, ++, -, -=, --, *, [], ->, typecast
Pointers in C are generally the thing that gives learners the most trouble. When C code is not written correctly with respect to pointer use, the resulting bugs can often be very difficult to find and correct. On the other hand, pointers are absolutely necessary in some cases.The designers of Java wanted to make programming easier and hence avoided adding pointers to the language. Java does have object references which accomplish much of what pointers accomplish albeit in a safer way.
You can either use references or you can simply return the result by value. Note that in C++, unlike C, references are not the same as pointers. C++ references are aliases, alternate names for existing objects, whereas pointers are just variables that may contain a memory address that can be dereferenced.
find the address