简单问题求助!请各位大侠不吝赐教!兄弟在此先谢了!
请各位大侠帮忙看看下面这段程序哪地方有问题??
#define OK 0
#define ERR 1
#define ERROR (-1)
#define BUFFER_SIZE 256
int GetMemory(char **ppszBuf,int num)
{
if(NULL == ppszBuf)
{
ASSERT(0);
return ERROR;
}
*ppszBuf = (char*)malloc(num);
if(NULL == *ppszBuf)
{
return ERROR;
}
return OK;
}
void test(void)
{
char *pcStr =NULL;
if(OK ==GetMemory(&pcStr,BUFFER_SIZE))
{
scanf("%s",pcStr);
printf(pcStr);
free(pcStr);
}
return;
}