Click here to Skip to main content
15,913,610 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: VERTICAL SCROLL is visible or available Pin
Naveen12-May-06 3:25
Naveen12-May-06 3:25 
GeneralRe: VERTICAL SCROLL is visible or available Pin
SimonSays12-May-06 10:51
SimonSays12-May-06 10:51 
Questionhow to save the time in a text file... Pin
BishoyShoukry12-May-06 2:40
BishoyShoukry12-May-06 2:40 
AnswerRe: how to save the time in a text file... Pin
vikramlinux12-May-06 2:45
vikramlinux12-May-06 2:45 
QuestionRe: how to save the time in a text file... Pin
David Crow12-May-06 4:19
David Crow12-May-06 4:19 
AnswerRe: how to save the time in a text file... Pin
ThatsAlok12-May-06 4:43
ThatsAlok12-May-06 4:43 
Questionthe same code compiling in devc++ but not in VS2005 Pin
sawerr12-May-06 1:40
sawerr12-May-06 1:40 
AnswerRe: the same code compiling in devc++ but not in VS2005 Pin
Cedric Moonen12-May-06 1:50
Cedric Moonen12-May-06 1:50 
In your main you declare C c;. This will call the default constructor of C which does nothing. When you leave the main function, the destructor of C will be called and this does:

C::~C()
{
cout << "deleting";
delete[] ch;
}


And ch is not initialized thus you try to free memory that has not been allocated. Always always intialize your member variables in your constructors !!!!
C::C()
{
cout << "default";
i = 0;
ch = NULL;
}


(in your destrutor, you can check the validity of your pointer with if(ch) but this is not required because it is safe to delete a NULL pointer, this will simply do nothing).


Cédric Moonen
Software developper

Charting control
GeneralRe: the same code compiling in devc++ but not in VS2005 Pin
sawerr12-May-06 1:59
sawerr12-May-06 1:59 
JokeRe: the same code compiling in devc++ but not in VS2005 Pin
James R. Twine12-May-06 2:35
James R. Twine12-May-06 2:35 
GeneralRe: the same code compiling in devc++ but not in VS2005 Pin
Gary R. Wheeler13-May-06 3:24
Gary R. Wheeler13-May-06 3:24 
Questionhow to write text in word application Pin
m_amit5012-May-06 1:24
m_amit5012-May-06 1:24 
AnswerRe: how to write text in word application Pin
_AnsHUMAN_ 12-May-06 1:28
_AnsHUMAN_ 12-May-06 1:28 
QuestionScrollbar Drawing message Pin
Sarath C12-May-06 0:58
Sarath C12-May-06 0:58 
AnswerRe: Scrollbar Drawing message Pin
Naveen12-May-06 1:23
Naveen12-May-06 1:23 
QuestionUnhandled Exception Pin
Anu_Bala12-May-06 0:44
Anu_Bala12-May-06 0:44 
AnswerRe: Unhandled Exception Pin
toxcct12-May-06 0:46
toxcct12-May-06 0:46 
AnswerRe: Unhandled Exception Pin
VinayCool12-May-06 0:50
VinayCool12-May-06 0:50 
GeneralRe: Unhandled Exception Pin
toxcct12-May-06 0:51
toxcct12-May-06 0:51 
GeneralRe: Unhandled Exception Pin
Anu_Bala12-May-06 0:56
Anu_Bala12-May-06 0:56 
GeneralRe: Unhandled Exception Pin
Hamid_RT12-May-06 1:12
Hamid_RT12-May-06 1:12 
GeneralRe: Unhandled Exception Pin
Cedric Moonen12-May-06 1:16
Cedric Moonen12-May-06 1:16 
GeneralRe: Unhandled Exception Pin
Hamid_RT12-May-06 1:19
Hamid_RT12-May-06 1:19 
GeneralRe: Unhandled Exception Pin
kakan12-May-06 2:23
professionalkakan12-May-06 2:23 
GeneralRe: Unhandled Exception Pin
ThatsAlok12-May-06 3:10
ThatsAlok12-May-06 3:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.