Jump to content
  • Advertisement
Sign in to follow this  
Cacks

What does double * mean?

This topic is 4840 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys, I know that '*' is the derefercing operator used for dereferencing pointers. But I keep seeing code like this - char** argv What does the "char**" mean? Dereference a pointer then another pointer? Thanks for any help!

Share this post


Link to post
Share on other sites
Advertisement
char ** means a pointer to a pointer to char. This isn't a dereference, but a type declaration. If you had: char ** a; then *a would be a pointer to a char, and **a would be a reference to a char.

Share this post


Link to post
Share on other sites
No (w.r.t. O.P.). The star has multiple meanings, for one think of multiplication. Basically there are three:

- multiplication
- pointer dereference
- pointer type declaration

Your example concerns the last one. Declaring a variable as

double* p;

defines a pointer that points to a double. Basically it takes an address in memory of which the contents should be interpreted as a double value.

Greetz,

Illco

Share this post


Link to post
Share on other sites
char **argv means argv is a pointer to a pointer. In argv's case, it's an array of strings (which a string is an array of chars).

EDIT: Looks like 3 ppl beat me. :)

-SirKnight

Share this post


Link to post
Share on other sites
Ah I see, an array of strings used for the input parameters,
referenced using 2 pointers.

Thanks for clearing that up guys!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!