Advertisement

Array of classes with elements not accessable?

Started by January 07, 2001 04:48 PM
2 comments, last by gimp 24 years ago
CPoint m_PointGrid[256]; // later in a loop m_PointGrid.x = 0; This fails with : subscript is not of integral type and left of ''.x'' must have class/struct/union type Anyone have any clues as to what I''m doing wrong here? Many thanks Chris
Chris Brodie
You need to tell it which memeber of the array to access:

m_PointGrid[t].x = 0;



That''s it.

- Matt



Advertisement
Dohhh... The board ate my code..

  CPoint m_PointGrid[256];// later in a loopm_PointGrid[i].x = 0;  


I shouldn''t need to cast it as a CPoint as it already is...

Any hints

Chris
Chris Brodie
Oh I see, now your error message makes more sense!

Have you defined the variable i as a float or a double? It needs to be a fixed point value, like; int, char, WORD, LONG, etc etc.

Cheers

Matt





Edited by - 3dModelMan on January 8, 2001 8:11:08 AM

This topic is closed to new replies.

Advertisement