HELP!
class SECTOR
{
public:
int numTriangles;
TRIANGLE *triangle;
};
...
SECTOR sector1;
...
sector1.triangle = new TRIANGLE[numTriangles];
When that is called it creates a runtime error that says :
Invalid allocation size: blah bytes
could someone tell me whats wrong and the right way to define at runtime a certain number of triangles?
NARF -
Pinky and the Brain
NARF - Pinky and the Brain
Have you initialized numTriangles?
____________________________________________________________AAAAA: American Association Against Adobe AcrobatYou know you hate PDFs...
There''s nothing wrong with the code you presented unless you misunderstood Raloth''s question. Try this out
SECTOR s;s.numTriagles = 10; //this is what initialization is abouts.triangle = new TRIANGLE[s.numTriagles];
"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement