Jump to content
  • Advertisement
Sign in to follow this  
Nikita21

Lose of array data

This topic is 4025 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 really can`t put my finger on this one, here is a chunk of codes relevant to the problem : when am attempting to store the question index value inside the subscript array, in a structure, i seem to be losing the data. Question index, accept the value of the question number enumerated Thanks in advance. [Edited by - Nikita21 on September 19, 2007 12:45:08 AM]

Share this post


Link to post
Share on other sites
Advertisement
An array of size 6 only allows indices between 0 and 5 inclusive. Accessing element 6 will not produce any kind of reliable effect, so don't do it.

Share this post


Link to post
Share on other sites
There's also nothing meaningful in the index array -- you never initialize it, so it has garbage data. I assume there's actually more to the code than this?

Share this post


Link to post
Share on other sites
Thanks for the help. there is much more to learn.

within or outside of the data structure?

[Edited by - Nikita21 on September 19, 2007 12:28:47 AM]

Share this post


Link to post
Share on other sites
Stop. What are you really trying to do? In English, please, not code (since that isn't getting anywhere right now). What kind of thing do you want to pass to the function? What do you want to get out? What do you want to happen as a side effect? And what are these data structures? A name like "Data_Storage" is about as perfectly unmeaningful as it gets.

Share this post


Link to post
Share on other sites
I am trying to store values returned from a function, within arrays.

I have a function, that generate a random number using rand().

Am trying to return the value generated by rand() to another function, that will store that value.

So i will be able to avoid from the value generated by rand, from been reused.

Somehow am trying to store the value`s generated within array, for later use, so i will be able to avoid them. like a mini storage.
however, i am unable to store these values in local scope arrays, since they will cease to exist, once the function will end.

Sorry if i am not clear enough, sometimes am having problems to express myself right.

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!