Delete a structure

Started by
0 comments, last by Ethan 22 years, 6 months ago
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?
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
baumep

This topic is closed to new replies.

Advertisement