[prog] use of the new and delete operator...

Kathryn Hogg kjh at flyballdogs.com
Thu Jul 12 12:48:00 UTC 2007


sena emre wrote:
>   In my C++ code, I have memory problems due to the use of new
> operator...I am trying to use delete to avoid this problem but I
> couldnot achieved...

What kind of problems?

>   I have a struct named solution
>
>   struct sol{
>   .
>   .
>   .
>   };
>
>   sol S;
>
>   S *sco = NULL;
>
>   sco = new sol[my.sco];
>
>   and I am defining a dynamic array of size my.sco...

What is the value of my.sco?  Have you verified that operator new is not
returning a NULL value?

> To avoid memry
> problems I am trying to use
>
>   delete [] sco;
>
>   but this does'nt work...what should I do?

What does the sol class, constructor, & destructor look like?

-- 
Kathryn
http://womensfooty.com


More information about the Programming mailing list