Click here to Skip to main content
15,914,070 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
Questiondatatypes conversion Pin
ikbahrian8-Nov-06 21:34
ikbahrian8-Nov-06 21:34 
AnswerRe: datatypes conversion Pin
Christian Graus8-Nov-06 21:44
protectorChristian Graus8-Nov-06 21:44 
GeneralRe: datatypes conversion Pin
ikbahrian8-Nov-06 22:27
ikbahrian8-Nov-06 22:27 
GeneralRe: datatypes conversion Pin
Christian Graus8-Nov-06 22:36
protectorChristian Graus8-Nov-06 22:36 
Questiondeleting char** Pin
abhiramsss8-Nov-06 15:03
abhiramsss8-Nov-06 15:03 
AnswerRe: deleting char** [modified] Pin
George L. Jackson8-Nov-06 15:56
George L. Jackson8-Nov-06 15:56 
GeneralRe: deleting char** Pin
abhiramsss9-Nov-06 6:24
abhiramsss9-Nov-06 6:24 
GeneralRe: deleting char** [modified] Pin
George L. Jackson9-Nov-06 13:40
George L. Jackson9-Nov-06 13:40 
First of all, foo looks like a function and not a class. So, you may need to find a good C++ Primer.

Memory management, especially with pointer-to-pointers, requires the programmer's special attention. Unless you are coding some performance critical code, STL would be a better route to go than to write "error prone" code with a limited knowledge of pointers and dynamic memory allocation.

See: http://www.codeproject.com/cpp/PointerArticle.asp[^]

void foo()
{
	char **name;
	name = new char*[3];
	<br>
	for (int i = 0; i < 3; ++i)
	{
		name[i] = new char[256];
	}
	<br>
	// Do your work here.
	// If an exception happens here, above or below,
	// a memory leak may occur.
	<br>
	// Time to clean up
	for (int i = 0; i < 3; ++i)
	{
		delete [] name[i];
	}
	<br>
	delete [] name;
}

Your code:
abhiramsss wrote:

if I have something like this
void foo
{
	char **name;
	name = new char*[3];
<br>
	for(int i = 0; i < 3; i++)
	{
		name[i] = new char[256];
	}
}

and iam creating three objects of foo like foo foo1[3];
is the following is code?
for(int j =0; j < 3; j++)
{
	for (int i; i < 3; ++i)
	{
		delete [j] name[i];
	}
<br>
	delete [j] name;
}

if not then how to delete name




-- modified at 22:18 Thursday 9th November, 2006
QuestionHow to use C++ app to make a call to find window on top in windows xp [modified] Pin
TFMegatron7-Nov-06 7:06
TFMegatron7-Nov-06 7:06 
AnswerRe: How to use C++ app to make a call to find window on top in windows xp Pin
Christian Graus7-Nov-06 9:17
protectorChristian Graus7-Nov-06 9:17 
GeneralRe: How to use C++ app to make a call to find window on top in windows xp Pin
TFMegatron7-Nov-06 15:47
TFMegatron7-Nov-06 15:47 
GeneralRe: How to use C++ app to make a call to find window on top in windows xp Pin
Christian Graus8-Nov-06 9:18
protectorChristian Graus8-Nov-06 9:18 
Questionhow to write string to MS access database through DAO? Pin
bloodwinner7-Nov-06 4:43
bloodwinner7-Nov-06 4:43 
AnswerRe: how to write string to MS access database through DAO? Pin
led mike7-Nov-06 4:57
led mike7-Nov-06 4:57 
QuestionSecure CRT Pin
d.coder6-Nov-06 9:40
d.coder6-Nov-06 9:40 
AnswerRe: Secure CRT Pin
Christian Graus6-Nov-06 10:03
protectorChristian Graus6-Nov-06 10:03 
GeneralRe: Secure CRT Pin
Nish Nishant7-Nov-06 4:53
sitebuilderNish Nishant7-Nov-06 4:53 
GeneralRe: Secure CRT Pin
George L. Jackson7-Nov-06 5:54
George L. Jackson7-Nov-06 5:54 
QuestionAccess Specifier in C++ [modified] Pin
B.Govindarajan5-Nov-06 22:41
B.Govindarajan5-Nov-06 22:41 
QuestionRe: Access Specifier in C++ Pin
Prashant Sabnekar6-Nov-06 0:24
Prashant Sabnekar6-Nov-06 0:24 
AnswerRe: Access Specifier in C++ Pin
B.Govindarajan6-Nov-06 2:21
B.Govindarajan6-Nov-06 2:21 
GeneralRe: Access Specifier in C++ Pin
led mike6-Nov-06 4:40
led mike6-Nov-06 4:40 
GeneralRe: Access Specifier in C++ Pin
Prashant Sabnekar6-Nov-06 17:37
Prashant Sabnekar6-Nov-06 17:37 
GeneralRe: Access Specifier in C++ Pin
led mike7-Nov-06 4:17
led mike7-Nov-06 4:17 
AnswerRe: Access Specifier in C++ Pin
led mike6-Nov-06 4:39
led mike6-Nov-06 4:39 

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.