C++ Pointers; Can someone use illustrations and explain?

 Dont Buy Textbooks. Rent 'EM Save 60-80%



Can someone give a simple explanation of the use of Pointers, how they work, and their purpose. Illustrations would be a +.

C++ Pointers; Can someone use illustrations and explain?c++ code



What are pointers?

Pointers are aptly named: they "point" to locations in memory. Think of a row of safety deposit boxes—of various sizes—at a local bank. Each safety deposit box will have a number associated with it, so that the teller can quickly look it up. These numbers are like the memory addresses of variables. A pointer in the world of safety deposit boxes would simply be anything that stored the number of another safety deposit box.

Perhaps you have a rich uncle who stored valuables in his safety deposit box, but decided to put the real location in another, smaller, safety deposit box that only stored a card with the number of the large box with the real jewelery. The safety deposit box with the card would be storing the location of another box; it would be equivalent to a pointer. In the computer, pointers are just variables that store memory addresses, usually the addresses of other variables.

The cool thing is that once you can talk about the address of a variable, you'll then be able to go to that address and retrieve the data stored in it. If you happen to have a huge piece of data that you want to pass into a function, it's a lot easier to pass its location to the function than to copy every element of the data! Moreover, if you need more memory for your program, you can request more memory from the system—how do you get "back" that memory? The system tells you where it is located in memory. In other words, you get a memory address back. And you need pointers to store the memory address.



More Related Questions and Answers ...
  • C++ Pointers to Strings?
  • Why do c pointers are faster than variables a..
  • Help on C++ declarations (pointers and arrays..
  • String constant and pointers in C++?
  • Pointers in c++ - i want only the pointers so..
  • " POINTERS"in C?
  • What is a fair salary for an asp.net and C# p..
  • I am a former programmer (C/C++). What is the..
  • C++/C# programmer learning Java 6 - should I ..
  • C programmer master please help me?
  • What are the tasks given to a fresher,when jo..
  • I need a c++ programmer to help me write a pr..
  • Am I A C++ Programmer, Or Software Engineer N..
  • How Many earns a junior C programmer in USA??
  • Can a C programmer help me?
  • I want to be a big C programmer.please tell t..
  • What all do I need to learn to become a C# pr..
  • C Programmer... anybody?
  • C Programmer...help(I'll give my 10 ..

  • The information post by website user , we not guarantee correctness.

    

    Dental Treatment Skin Whitening Skin Problems Skin Rashes Shoes