Jump to content
  • Advertisement

Archived

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

The Bag

Allocating memory for this array - int (* a)[10]

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

I was recently asked in a test what this: int (* a)[10]; was. I have since put in into visual studio, but I cannot work out how to allocate memory for it. How do I do this?

Share this post


Link to post
Share on other sites
Advertisement
It is simply a pointer to an array of 10 ints.


int (*p)[10] = new int[1][10];

Share this post


Link to post
Share on other sites
It''s a pointer to an array of integers. Remove the parentheses and it''s an array of pointers to integers.

Don''t ask homework questions on here.

Share this post


Link to post
Share on other sites
Thanks guys.

quote:
Original post by Etnu
It's a pointer to an array of integers. Remove the parentheses and it's an array of pointers to integers.

Don't ask homework questions on here.


It's not a homework question - it was part of a test I had to do the other week, but I had no idea what it was.

[edited by - The Bag on May 31, 2004 1:05:29 PM]

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!