void GetMemory(char* p)
{
p = (char*)malloc(100);
}
void Test()
{
char* str = NULL;
GetMemory(str);
strcpy(str,"Crash");
printf("str = %s",str);
}
char* GetMemory()
{
char* p = "HelloWorld";
return p;
}
void Test()
{
char* str = NULL;
str = GetMemory();
printf("str : %s",str);
}
void GetMemory(char** p,const int num)
{
*p = (char*)malloc(num);
}
void Test()
{
char* str = NULL;
GetMomory(&str);
strcpy(str,"unCrash");
printf("str : %s",str);
}
void Test()
{
char* str = (char*)malloc(100);
if (str != NULL)
{
strcpy(str,"unKown");
free(str);
}
if (str != NULL)
{
strcpy(str,"unKown");
printf("str : %s",str);
}
}