crack wrote:
Hi ,
i would like to delete a structure of type
typedef struct Mystruct
{
int a;
TCHAR b[256];
TCHAR*c;
}MYSTRUCT
i am a allocating memory as
MYSTRUCT *Mystr = new (MYSTRUCT );
?but how to free this memeory ???/////
I'll suppose that you have defined the type TCHAR somewhere. Just to be
sure we're all together on this, always try to use known types. Your
example could easily have used a simple and known type of char, unsigned
char, or signed char and gained clarity.
Now, this is not the way to allocate memory in C. There is no 'new'
operator in C. Dynamic allocation is done with malloc(), calloc(), or
realloc() in portable C programs, and is freed with free().
If you are learning C++, any questions belong in the newsgroup for that
<snide adjective herelanguage, <news:comp.lang.c++>. Before posting
there, do what you have not done before posting here: check the FAQ,
check past postings for a week or so (easily done with Google groups),
and make sure this isn't a trivial thing you could look up in an
elementary textbook. I suspect it is just such an elementary question
that any elementary C++ text provides the answer to. Have you checked
the index? The entries for either 'new' or 'delete' should get you to
the answer.
If your question is for some other heathen C++-like language, then there
is probably a newsgroup provided by the owner of that proprietary language.