Click here to Skip to main content
15,908,013 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Memory Management Problem C++ (malloc & free) Pin
Rajkumar R4-May-08 21:16
Rajkumar R4-May-08 21:16 
AnswerRe: Memory Management Problem C++ (malloc & free) Pin
BadKarma4-May-08 21:25
BadKarma4-May-08 21:25 
QuestionRe: Memory Management Problem C++ (malloc & free) Pin
Rajkumar R4-May-08 21:34
Rajkumar R4-May-08 21:34 
AnswerRe: Memory Management Problem C++ (malloc & free) Pin
Rajesh R Subramanian4-May-08 22:41
professionalRajesh R Subramanian4-May-08 22:41 
AnswerRe: Memory Management Problem C++ (malloc & free) Pin
Eakalavya4-May-08 21:25
Eakalavya4-May-08 21:25 
GeneralRe: Memory Management Problem C++ (malloc & free) Pin
dehseth5-May-08 1:12
dehseth5-May-08 1:12 
AnswerRe: Memory Management Problem C++ (malloc & free) Pin
jhwurmbach4-May-08 21:36
jhwurmbach4-May-08 21:36 
AnswerRe: Memory Management Problem C++ (malloc & free) Pin
CPallini4-May-08 21:41
mveCPallini4-May-08 21:41 
You make the same error on each allocation:
For instance your code is
dehseth wrote:
a = (char**) calloc(10, sizeof(char));


but a is declared as follows
char ** a;

hence you must allocate memory this way
a = (char**) calloc(10, sizeof(char <big>*</big>));


Please note the * operator inside sizeof.

BTW as Cedric Moonen already stated, in C++ language, new is the preferred way to allocate memory.
Smile | :)

If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.

This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke


GeneralRe: Memory Management Problem C++ (malloc & free) Pin
dehseth5-May-08 0:45
dehseth5-May-08 0:45 
QuestionRe: Memory Management Problem C++ (malloc & free) Pin
David Crow5-May-08 3:34
David Crow5-May-08 3:34 
AnswerRe: Memory Management Problem C++ (malloc & free) Pin
dehseth5-May-08 6:05
dehseth5-May-08 6:05 
GeneralRe: Memory Management Problem C++ (malloc & free) Pin
David Crow5-May-08 6:17
David Crow5-May-08 6:17 
QuestionUse Date/Time in SQL statement Pin
includeh104-May-08 20:29
includeh104-May-08 20:29 
QuestionRe: Use Date/Time in SQL statement Pin
Rajesh R Subramanian4-May-08 20:41
professionalRajesh R Subramanian4-May-08 20:41 
AnswerRe: Use Date/Time in SQL statement Pin
Ozer Karaagac5-May-08 0:03
professionalOzer Karaagac5-May-08 0:03 
QuestionNeed a solution in adding activeX controls in MFC dialog.... Pin
Khathar4-May-08 19:37
Khathar4-May-08 19:37 
AnswerRe: Need a solution in adding activeX controls in MFC dialog.... Pin
Hamid_RT4-May-08 19:43
Hamid_RT4-May-08 19:43 
AnswerRe: Need a solution in adding activeX controls in MFC dialog.... Pin
Rajkumar R4-May-08 20:57
Rajkumar R4-May-08 20:57 
Questioncreating a status bar in VC++,MFC Pin
Mohanraj D4-May-08 18:47
Mohanraj D4-May-08 18:47 
AnswerRe: creating a status bar in VC++,MFC Pin
Hamid_RT4-May-08 19:07
Hamid_RT4-May-08 19:07 
GeneralRe: creating a status bar in VC++,MFC Pin
Mohanraj D4-May-08 19:27
Mohanraj D4-May-08 19:27 
GeneralRe: creating a status bar in VC++,MFC Pin
Nitheesh George4-May-08 19:32
Nitheesh George4-May-08 19:32 
GeneralRe: creating a status bar in VC++,MFC Pin
Mohanraj D4-May-08 20:01
Mohanraj D4-May-08 20:01 
GeneralRe: creating a status bar in VC++,MFC Pin
Hamid_RT4-May-08 20:33
Hamid_RT4-May-08 20:33 
GeneralRe: creating a status bar in VC++,MFC Pin
Rajkumar R4-May-08 21:31
Rajkumar R4-May-08 21:31 

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.