#include "stdio.h"
int main()
{
int input;
int *p;
input=12;
P=&input;
printf("%d\n",input);
printf("%P\n",p);
return 0;
}
--------------------Configuration: 1 - Win32 Debug--------------------
Compiling...
1.cpp
F:\Program Files\Microsoft Visual Studio\MyProjects\lx\1.cpp(7) : error C2065: 'P' : undeclared identifier
F:\Program Files\Microsoft Visual Studio\MyProjects\lx\1.cpp(7) : error C2440: '=' : cannot convert from 'int *' to 'int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
执行 cl.exe 时出错.
1.obj - 1 error(s), 0 warning(s)
int main()
{
int input;
int *p;
input=12;
P=&input; //把P改成小写的p
printf("%d\n",input);
printf("%P\n",p); //这里第一个的P改成d, 第二个p前面加个*
return 0;
}
但是 main应该是void 无返回值吧?
你返回个0干什么的?追问
我不太清楚 貌似void main 无返回值 int main 最后需要返回个0 我刚学 不太清楚 但是例题是这样的 等待高手解决
追答cannot convert from 'int *' to 'int'