Click here to Skip to main content
14,981,861 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: small sample of where problem ocurres. Pin
gizmokaka7-Sep-07 22:34
Membergizmokaka7-Sep-07 22:34 
GeneralRe: small sample of where problem ocurres. Pin
John R. Shaw7-Sep-07 22:42
MemberJohn R. Shaw7-Sep-07 22:42 
GeneralRe: small sample of where problem ocurres. Pin
markkuk7-Sep-07 23:12
Membermarkkuk7-Sep-07 23:12 
GeneralRe: small sample of where problem ocurres. Pin
gizmokaka7-Sep-07 23:21
Membergizmokaka7-Sep-07 23:21 
GeneralRe: small sample of where problem ocurres. Pin
John R. Shaw7-Sep-07 23:24
MemberJohn R. Shaw7-Sep-07 23:24 
GeneralRe: small sample of where problem ocurres. Pin
Leslie Sanford7-Sep-07 23:42
MemberLeslie Sanford7-Sep-07 23:42 
GeneralRe: Another qestion on the same subject. Pin
gizmokaka8-Sep-07 0:20
Membergizmokaka8-Sep-07 0:20 
GeneralRe: small sample of where problem ocurres. Pin
Russell'7-Sep-07 23:33
MemberRussell'7-Sep-07 23:33 
Be care with pointers!Big Grin | :-D


void main ()
{
	int num = 2<code>, i</code>;
	char** str_array;
	char str1[] = "first string";
	char str2[] = "second string";

	<code>str_array=NULL;</code>
	str_array  = (char**)malloc(sizeof(char*)*num);
	<code>for(i=0;i<num,i++) str_array[i]=NULL;</code>
	str_array[0] = (char*)malloc(sizeof(char)*strlen(str1));
	<code>for(i=0;i<strlen(str1),i++) str_array[0][i]=NULL;</code>
	str_array[1] = (char*)malloc(sizeof(char)*strlen(str2));
	<code>for(i=0;i<strlen(str2),i++) str_array[1][i]=NULL;</code>
	strcpy (str_array[0],str1);
	strcpy (str_array[1],str2);
	
	printf("%s \n",str_array[0]);
	printf("%s \n",str_array[1]);

	<code>if(str_array[0]!=NULL)</code>
		free(str_array[0]);
	<code>if(str_array[1]!=NULL)</code>
		free(str_array[1]);
	<code>if(str_array!=NULL)</code>
		free(str_array);
}





Russell

QuestionClosing a view Pin
bob169727-Sep-07 11:08
Memberbob169727-Sep-07 11:08 
AnswerRe: Closing a view Pin
Russell'7-Sep-07 23:02
MemberRussell'7-Sep-07 23:02 
GeneralRe: Closing a view Pin
bob169728-Sep-07 4:44
Memberbob169728-Sep-07 4:44 
GeneralRe: Closing a view Pin
Mark Salsbery8-Sep-07 7:04
MemberMark Salsbery8-Sep-07 7:04 
GeneralRe: Closing a view Pin
bob169728-Sep-07 9:14
Memberbob169728-Sep-07 9:14 
GeneralRe: Closing a view Pin
Mark Salsbery8-Sep-07 10:51
MemberMark Salsbery8-Sep-07 10:51 
AnswerRe: Closing a view Pin
Nelek12-Sep-07 0:02
protectorNelek12-Sep-07 0:02 
Questiontree graph Pin
Chris Losinger7-Sep-07 10:48
professionalChris Losinger7-Sep-07 10:48 
AnswerRe: tree graph Pin
El Corazon7-Sep-07 11:25
MemberEl Corazon7-Sep-07 11:25 
AnswerRe: tree graph Pin
El Corazon7-Sep-07 11:32
MemberEl Corazon7-Sep-07 11:32 
QuestionMDI multiple view types - Window List Pin
bob169727-Sep-07 10:12
Memberbob169727-Sep-07 10:12 
AnswerRe: MDI multiple view types - Window List Pin
bob169727-Sep-07 14:15
Memberbob169727-Sep-07 14:15 
GeneralRe: MDI multiple view types - Window List Pin
bob169727-Sep-07 14:21
Memberbob169727-Sep-07 14:21 
AnswerRe: MDI multiple view types - Window List Pin
Nelek12-Sep-07 0:08
protectorNelek12-Sep-07 0:08 
QuestionHow to prevent library/software cracking Pin
Hirakawa7-Sep-07 9:53
MemberHirakawa7-Sep-07 9:53 
AnswerRe: How to prevent library/software cracking Pin
David Crow7-Sep-07 10:16
MemberDavid Crow7-Sep-07 10:16 
GeneralRe: How to prevent library/software cracking Pin
Hirakawa7-Sep-07 21:08
MemberHirakawa7-Sep-07 21:08 

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.