void main()
{
int const *p=5;
cout<<++(*p);
}
What will this do? Is it wrong and if so, why? Please make me understand. Thank you!
void main()
{
int const *p=5;
cout<<++(*p);
}
What will this do? Is it wrong and if so, why? Please make me understand. Thank you!
What will this do?
The program is ill-formed and may refuse to compile. If it compiles, the behaviour is not specified by the standard.
Is it wrong and if so, why?
It is. Because:
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'