[提问]一个简单的C程序问题求解
以下程序在VC6下调试的时候提示:
--------------------Configuration: 2 - Win32 Debug--------------------
Compiling...
2.C
C:\2.C(11) : warning C4013: 'get' undefined; assuming extern returning int
C:\2.C(11) : warning C4047: '=' : 'char *' differs in levels of indirection from 'int '
C:\2.C(11) : warning C4047: '!=' : 'int ' differs in levels of indirection from 'void *'
2.OBJ - 0 error(s), 3 warning(s)
程序来自《21天学通C语言(翻译)》的书中源程序。
程序源文件如下:
#include "stdio.h"
#include "stdlib.h"
char *ptr,input;
main(void)
{
ptr=malloc(257*sizeof(char));
puts("Enter text a line at a time,then press Enter.");
puts("Enter a blank line when done.");
while(*(ptr=get(input))!=NULL)
{
printf("You entered %s\n",input);
puts(ptr);
}
puts("Thank you and goodbye!\n");
return 0;
}
小人第一次来CSDN,什么都不太明白,万望各位高人给个指点。万分感谢:)
Good luck!