void main()
{
int const *p=5;
cout<<++(*p);
}
这会怎么做?这是错的,如果是的话,为什么?请让我明白。谢谢!
答案 0 :(得分:2)
这会做什么?
该程序格式不正确,可能拒绝编译。如果进行编译,则标准不会指定行为。
这是错的,如果是的话,为什么?
是的。这是因为:
error: '::main' must return 'int' error: invalid conversion from 'int' to 'const int*' error: 'cout' was not declared in this scope error: increment of read-only location '* p'