PDA

View Full Version : pointers


Bmxpunk86pl
02-17-02, 09:34 PM
Ok please varify this for me, in C++:

The "&" points to the memory address and the "*" points to the variable stored in a specified memory address?

OR

Does the "&" get the memory address and the * just reads the data in a specified memory location?

Guid0
02-17-02, 09:53 PM
(&), which literally means "address of"

(*), that can be literally translated to "value pointed by".

it's call by reference\value aswell


Good sight that explains it in english (http://www.cplusplus.com/doc/tutorial/tut3-3.html)

Bmxpunk86pl
02-17-02, 09:56 PM
i dont understand what u mean value pointed at by?

Guid0
02-17-02, 10:09 PM
& ponts to memory address of"

* points to value of


beth = ted; // beth equal to ted
beth = *ted; // beth equal to value pointed by ted



andy and fred are both equalt to 25
andy = 25;
fred = andy;

and ted is equal to andy's memory location so if teds memory locations is 7777 tedis now equal to andy's memory location of 7777 and not 25

ted = &andy;

Bmxpunk86pl
02-18-02, 01:13 PM
but what value is ted pointing too?

i understand the & but not the *