• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# the **

## Recommended Posts

ok... int myInt = 5; int *pmyInt = &myInt; if you return pmyInt it gives the address of the variable myInt and *pmyInt gives the value of myInt which is 5. What the hell is int **psomething ??? int myInt = 5; int *pmyInt = &myInt; int **ppmyInt = &pmyInt; *ppmyInt return the address of pmyInt and **ppmyInt the value or what?

##### Share on other sites
** means "a pointer to a pointer" (yep, its possible since pointers are really just variables that contain an offset).

So **ppmyInt should give you the value of myInt since your just dereferencing it like so: ppmyint->pmyint->myInt.

Brain hurt yet?

----------------------------------------
Whenever I see an old lady slip and fall on a wet sidewalk, my first instinct is to laugh. But then I think, what if I was an ant and she fell on me? Then it wouldn't seem quite so funny.

Edited by - The Senshi on July 24, 2000 4:28:38 PM

##### Share on other sites

Yes, **ppmyInt will return the value in myInt.

-Mezz

##### Share on other sites
Something is a Something
Something *p is a pointer to a Something.
Something **pp is a pointer to a pointer to a Something.
etc.

**ppmyInt is the int itself.

int myInt = 5; // The value of myInt is 5
int *pmyInt = &myInt; // The value of pmyInt is the address of myInt
int *ppmyInt = &pmyInt; // The value of ppmyInt is the address of pmyInt

*ppmyInt is not the address of pmyInt, it''s the value of pmyInt (the value of the pointer not the int).

##### Share on other sites
that''s not confusing! this is: ****************p

-----------------------------

A wise man once said "A person with half a clue is more dangerous than a person with or without one."

##### Share on other sites
does **ppmyInt returns the value of myInt or the address of it(which is the value of pmyInt)???

##### Share on other sites
does **ppmyInt returns the value of myInt or the address of it(which is the value of pmyInt)???

##### Share on other sites
check it out......!!!

#include

int main()
{
int myInt = 5;
int * pmyInt = &myInt;
int ** ppmyInt = &pmyInt;

cout << "myInt: " << myInt << "\n";
cout << "&myInt: " << &myInt << "\n";
cout << "pmyInt: " << pmyInt << "\n";
cout << "&pmyInt: " << &pmyInt << "\n";
cout << "*pmyInt: " << *pmyInt << "\n";
cout << "ppmyInt: " << ppmyInt << "\n";
cout << "&ppmyInt: " << &ppmyInt << "\n";
cout << "*ppmyInt: " << *ppmyInt << "\n";
cout << "**ppmyInt: " << **ppmyInt << "\n";

return (0);
}

OUTPUT:
myInt: 5
&myInt: 0x0065FDF4
pmyInt: 0x0065FDF4
&pmyInt: 0x0065FDF0
*pmyInt: 5
ppmyInt: 0x0065FDF0
&ppmyInt: 0x0065FDEC
*ppmyInt: 0x0065FDF4
**ppmyInt: 5

eh? how''s that! good way to answer a question yourself.

• ### Forum Statistics

• Total Topics
628275
• Total Posts
2981741

• 10
• 11
• 17
• 10
• 9