Skip to main content
gamedev.net
🔒 Locked

Delete a structure

Started by Ethan Oct 15, 2001 at 12:22 PM 0 replies 350+ views
Original Post
Ethan
Ethan
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?
baumep
baumep
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
baumep

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.