双指针的问题
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,这是代表*p=&str吗?如果换成str行不行?
2016-07-19 14:11
2016-07-19 14:38
2016-07-19 16:29
2016-07-21 10:33