Click here to Skip to main content
15,893,904 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Question(WinAPI) RasDial & RasHangUp Pin
shareholder77128-Apr-07 20:02
shareholder77128-Apr-07 20:02 
AnswerRe: (WinAPI) RasDial & RasHangUp Pin
PJ Arends28-Apr-07 22:04
professionalPJ Arends28-Apr-07 22:04 
GeneralRe: (WinAPI) RasDial & RasHangUp Pin
shareholder7715-May-07 21:52
shareholder7715-May-07 21:52 
QuestionDetecting Microphone Input Pin
selmak28-Apr-07 17:07
selmak28-Apr-07 17:07 
AnswerRe: Detecting Microphone Input Pin
Mark Salsbery29-Apr-07 8:30
Mark Salsbery29-Apr-07 8:30 
GeneralRe: Detecting Microphone Input Pin
selmak29-Apr-07 10:43
selmak29-Apr-07 10:43 
QuestionHow can i get access to the base object in ActiveX develop ? Pin
Yanshof28-Apr-07 16:53
Yanshof28-Apr-07 16:53 
QuestionDynamic memory allocation, C Pin
C_Zealot28-Apr-07 16:30
C_Zealot28-Apr-07 16:30 
Hi all:

Here is my question.

struct _wordTable {
char *word;
int count;
};

/*I need to dynamically allocate memory for every _wordTable structure.*/

/*What I have done is:*/

struct _wordTable *word_ptr = NULL;

word_ptr = malloc(sizeof(struct _wordTable));

if (word_ptr != NULL) {
word_ptr->word = malloc(wordSize * sizeof(char) + 1); /* wordSize if the length of the char string pointed by *word.*/
}

/*Is my coding OK? Since it worries me that I allocated memory for the struct first, followed by allocation of its string.*/

Thanks




AnswerRe: Dynamic memory allocation, C Pin
Arun.Immanuel28-Apr-07 17:21
Arun.Immanuel28-Apr-07 17:21 
GeneralRe: Dynamic memory allocation, C Pin
C_Zealot28-Apr-07 17:26
C_Zealot28-Apr-07 17:26 
GeneralRe: Dynamic memory allocation, C Pin
John R. Shaw28-Apr-07 21:31
John R. Shaw28-Apr-07 21:31 
AnswerRe: Dynamic memory allocation, C Pin
John R. Shaw28-Apr-07 21:49
John R. Shaw28-Apr-07 21:49 
Questionabout event Pin
HOW WHAT28-Apr-07 14:40
HOW WHAT28-Apr-07 14:40 
AnswerRe: about event Pin
Christian Graus28-Apr-07 14:57
protectorChristian Graus28-Apr-07 14:57 
GeneralRe: about event Pin
HOW WHAT28-Apr-07 15:11
HOW WHAT28-Apr-07 15:11 
GeneralRe: about event Pin
Christian Graus28-Apr-07 15:20
protectorChristian Graus28-Apr-07 15:20 
GeneralRe: about event Pin
HOW WHAT29-Apr-07 2:42
HOW WHAT29-Apr-07 2:42 
GeneralRe: about event Pin
Joan M28-Apr-07 23:47
professionalJoan M28-Apr-07 23:47 
GeneralRe: about event Pin
HOW WHAT29-Apr-07 2:44
HOW WHAT29-Apr-07 2:44 
GeneralRe: about event Pin
Joan M29-Apr-07 4:53
professionalJoan M29-Apr-07 4:53 
QuestionMemory handling/Bad practice? Pin
alex.barylski28-Apr-07 12:35
alex.barylski28-Apr-07 12:35 
AnswerRe: Memory handling/Bad practice? Pin
cmk28-Apr-07 12:56
cmk28-Apr-07 12:56 
AnswerRe: Memory handling/Bad practice? Pin
John R. Shaw28-Apr-07 14:42
John R. Shaw28-Apr-07 14:42 
QuestionAutoProxy detection via script "FindProxyForURL" Pin
Peter Weyzen28-Apr-07 11:50
Peter Weyzen28-Apr-07 11:50 
QuestionMSChart in VC++2005 Pin
hahahua28-Apr-07 10:38
hahahua28-Apr-07 10:38 

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.