English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

3 answers

i'm still learning myself but try this

http://www.cplusplus.com/doc/tutorial/pointers.html

2007-11-19 03:53:58 · answer #1 · answered by Blake 4 · 1 1

In computer memory, each byte has an address and a value.

Given the line
char myVar = 'D';

The compiler puts the value 'D' in some memory address.

In C/C++ you can actually get that address with the & operator.

char * myValAddress = &myVal.

Think of the & operator as the "the address at" operator.

when you see
char * myValAddress = &myVal
read it in your head as
myValAddress equals "the address at" which myVal is stored.

Now myValAddress is a "pointer" to the location where myVal is stored.

You can now either change or get the value with the variable name myVal, or change the value by "dereferencing" the address pointer with the * operator.

char newVal = myVal;
char newVal = *myValAddress;


think of the * operator as "the value pointed to by"

when you see
*myValAddress = 'F';
read it in your head as
"the value pointed to by" myValAddress equals 'F';

Any quest, email me at redflats@yahoo.com

2007-11-19 03:56:14 · answer #2 · answered by SWEngr 3 · 3 0

A string.

2007-11-19 04:00:32 · answer #3 · answered by RICHARD B 3 · 0 2

fedest.com, questions and answers