Topic: Newbie needs help w/ pointers


Author: cpp@netcom.com (Robin Rowe)
Date: 1995/04/30
Raw View
Ok, so what do you want to know about pointers?

1. A pointer is the address (location) of something in memory.

Think of a pointer as being like a handle that you can attach to any
"suitcase" containing some data in memory. Or, think of pointers as being
like a switchboard, you can connect names to data. As with people, your
data can communicate through connections instead of being physically moved.

2. A pointer is declared like this:

 char* buffer="Hello";//pointer to a null terminated string.

3. Pointers are ultimately used by taking their contents (what the
address points to):

 char c=*buffer; //c=='H'

4. Pointers can have offsets added to them or be treated as though they
were arrays:

 char c=*(buffer+1); //c=='e';
 char c=buffer[1];//equivalent, c=='e'

More?

Robin
--
-----
Robin Rowe       cpp@netcom.com       408-626-6646          Carmel, CA
Rowe Technology  C++ Design/Training  Email for sample C++ Newsletter!





Author: gengeo1@cam.org (George Genovezos)
Date: 1995/04/29
Raw View
Hi,
I am attempting to grasp the concept of pointers with no success. If anyone
can help please send me an email.

thanks

gengeo1@cam.org