• Advertisement

Archived

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

Delete a structure

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

I have a structure like this: typedef struct COLOR{ int r; int g; int b; int a; }COLOR; typedef struct VERTEX{ int x; int y; int z; COLOR color; }VERTEX; VERTEX *vVertex; and i can''t free the vVertex. Can somebody help me?

Share this post


Link to post
Share on other sites
Advertisement
Have you done sth. like

VERTEX *vVertex = new Vertex;
//...code....
if(vVertex) delete[] vVertx;

this?
You may get into trouble if you try to delete vVertx without initializing it/allocating memory for it as in the last line of your code you posted.
(new and delete equal malloc and free in c)

baumep

Share this post


Link to post
Share on other sites

  • Advertisement