Archived

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

what did i do?

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

did some errors while coding. made a two-dimensional array something like this: the_array[10,10]; this compiled however a the result i got out of the code i was writing was not entierly different from what i wanted (i got rows like the whole row seven instead of a point if i put in 7,x for example) this was responsible for this problem taking some time to debug since it made me think i made a logic error instead of a syntax one... just curious what did i do, why did it give the result it did?

Share this post


Link to post
Share on other sites
I can''t understand what you''re trying to say... but (assuming C/C++) arrays aren''t define like array[10,10], they''re define like array[10][10]. I don''t know if this is just an example or if you really defined it like that.

Share this post


Link to post
Share on other sites
int x[10,10];

afaik would be the same as:

int x[10];

since the first 10 would be evaluated and outputed no-where and the other 10 would set the array size. If you can load from it like is a 100 element array, then you are just lucky, you are read/writing to memory that is not yours, and if it works, its just blind luck. As the previous poster said...

int x[10][10];

is the correct method to use.

Share this post


Link to post
Share on other sites