Advertisement

HELP!

Started by July 12, 2003 08:17 PM
3 comments, last by TheProx 21 years, 7 months ago
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...
Advertisement
yes

NARF -
Pinky and the Brain
NARF - Pinky and the Brain
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
wow... so simple yet so complicated ... but thanks!

NARF -
Pinky and the Brain
NARF - Pinky and the Brain

This topic is closed to new replies.

Advertisement