gnirut
0
Lets understand pointers without using computer science jargon. Imagine that you are participating in a treasure hunt with a difference - there are several houses that you have to visit as part of the treasure hunt. The first clue given to you has 2 parts - the clue itself, and the address of the first house. Once you solve the first clue, you have to go to the address specified and mention the answer to the security guard. If the answer is correct, you can go inside and pick up the 2nd clue which has 2 parts - the clue itself and the address to the next house. Once you solve this clue, you have to go the address specified. There, you have to tell the answer to the security guard. A correct answer gives you access to the next clue that has 2 parts - the clue itself and the address of the next house. In this example, we have created pointers and a linked list. Each clue contains 2 parts - the clue and an address. The address of the house is the pointer - it points to where something is located (in this case, the next clue). To see the linked list in this example - the first clue points to the first house. The first house contains a clue that points to the 2nd house. The 2nd house contains a clue that points to the 3rd house, and so on. This is your linked list. Unlike real-world addresses, addresses in computers are numbers usually written in hexadecimal. Like in real-world, the pointer is just an address. The address is how any memory location is accessed. Once the address is specified, the computer knows how to fetch data stored at that address, or write new data to that address.