![]() |
#2
天使梦魔2008-02-11 20:25
|
void GetMemory( char **p, int num )
{
*p = (char *) malloc( num );
}
void Test( void )
{
char *str = NULL;
GetMemory( &str, 100 );
strcpy( str, "hello" );
printf( str );
}
str为空,那么会在申请空间之后得到地址吗?会不会是野指针?