Hi Experts,
I am having problems with the below c++ code
func manu()
{
char *Test1 = NULL;
char *Test2 = NULL;
int returnCode;
// I pass Test1 to another function and populate its value;
returnCode = function ( Test1 );
Test2 = Test1;
// when i print Test1 and Test2, sometimes they both have different values ( NOT ALWAYS, after i run them continuously for a couple of days )
// Also sometimes, if I access Test2, the program crashes and generates core.
// Please not, the above is part of a multithreaded program.
delete Test1;
delete Test2;
}
Could someone please tell me what is wrong with this code.
I am having problems with the below c++ code
func manu()
{
char *Test1 = NULL;
char *Test2 = NULL;
int returnCode;
// I pass Test1 to another function and populate its value;
returnCode = function ( Test1 );
Test2 = Test1;
// when i print Test1 and Test2, sometimes they both have different values ( NOT ALWAYS, after i run them continuously for a couple of days )
// Also sometimes, if I access Test2, the program crashes and generates core.
// Please not, the above is part of a multithreaded program.
delete Test1;
delete Test2;
}
Could someone please tell me what is wrong with this code.
Comment