Archived

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

Problems with Arrays in Visual Studio7.net

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

hi all. i seem to be having problems with arrays:
  
float doink[16];

for (int i = 0; i < 4; i++)
  for (int x = 0; x < 4; x++)
    doink [i][x] = i*x;
  
i get a error about ''doink [x]''. am i forgetting something? do i have to set a flag or something? thank frank

Share this post


Link to post
Share on other sites
These two types are different:
    
float doink[16];
float doink[4][4];

You're trying to treat them the same. Hence the error.



Edited by - Stoffel on February 21, 2002 4:16:55 PM

Share this post


Link to post
Share on other sites
Yeah, it was pointer arithmetic. You can use doink[i * x] if you want to use 2 variables to access the array. . .

Edited by - acw83 on February 21, 2002 8:26:12 PM

Share this post


Link to post
Share on other sites