Jump to content
  • Advertisement

Archived

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

jonbell

Copying an array reference

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

Given an array of pointer to ints, how can i copy a refernce to the array? int *array[100]; int *i i = array; i[0] = blah blah; I''m sure you get what i mean but i get the following e error C2440: ''='' : cannot convert from ''int *[100]'' to ''int *''

Share this post


Link to post
Share on other sites
Advertisement
If i use the above technique i can assign my new variable to the array but i cannot access it like an array :

i[5] = xxx;

is it possible to do this?

[edited by - jonbell on May 26, 2003 4:02:25 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by jonbell
If i use the above technique i can assign my new variable to the array but i cannot access it like an array :

i[5] = xxx;

is it possible to do this?



array is a pointer to pointers.

i is a pointer to ints.

Thus, they are not the same type.

If you declare i like Lektrix said, they are of the same type and then you could use i like you want.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!