error C2297: '*' : illegal, right operand has type 'int *'

#include<iostream>
using namespace std;
int main()
{
int a=1,b=2,c=3;
int *d=b;
*d=&c;
cout<<*d<<a<<endl;
return 0;
}

 

C++ primer上的练习,在学校机房用vc6.0写的,总是出现这个错误

现在才发现,其实是指针定义时没有在最后加上分号。

posted @ 2019-03-11 20:22  Harvest-12580  阅读(1467)  评论(0)    收藏  举报