Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 cout with pointers
Index -> Programming, C++ -> C++ Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
hamid1455




PostPosted: Sun Mar 31, 2013 1:04 pm   Post subject: cout with pointers

Say I have a pointer like this:

double meow = 0;
double * pDouble = &meow;

Then cout << &pDouble; will print the memory address that pDouble is pointing to, right?

So then what is the memory address that I get when I output just plain old pDouble?

Also, outputting *pDouble gives me the value of the pointer or the value of what the pointer is pointing to?

Thanks in advance guys.
Sponsor
Sponsor
Sponsor
sponsor
linuxp




PostPosted: Sun Mar 31, 2013 1:13 pm   Post subject: RE:cout with pointers

pDouble = &meow = address of meow
*pDouble = meow = value of meow
&pDouble = address of pDouble itself
hamid1455




PostPosted: Sun Mar 31, 2013 1:42 pm   Post subject: Re: cout with pointers

so I could make a pointer that points to another pointer?
nullptr




PostPosted: Sun Mar 31, 2013 3:34 pm   Post subject: Re: cout with pointers

Yes. And you could make a pointer that points to a pointer that points to a pointer if you wanted to. int************ p; is valid C++ code, though I can't think why you would need that many levels of pointers.
Display posts from previous:   
   Index -> Programming, C++ -> C++ Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: