Jump to content
  • Advertisement

Archived

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

Melo

Pointer Arrays

This topic is 6778 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

Call me a newbie, but I don''t know how they work? I need to know this for my new GUI. Can you tell me please

Share this post


Link to post
Share on other sites
Advertisement
Pointer arrays work just as normal arrays...


int main(void)
{
//An array of pointers-to-ints
int *p_array[10];
//4 ints
int a, b, c, d;

//Init the pointers with the addresses of some vars
p_array[0] = &a;
p_array[1] = &b;
p_array[2] = &c;
p_array[3] = &d;

//Change the value of a to 666
*p_array[0] = 666;

//Change the value of b to 555
*p_array[1] = 555;

//Change the value of c to 444
*p_array[2] = 444;

//Change the value of d to 333
*p_array[3] = 333;

return 0;
}


/. Muzzafarath

Edited by - Muzzafarath on 4/2/00 6:39:12 AM

Share this post


Link to post
Share on other sites
Thank you!

I couldn''t find anything about pointer arrays in my c++ book. I didn''t know that is is *so easy*!

Share this post


Link to post
Share on other sites

  • 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!