Why in C++,variable declared as an array can be added or subtracted with whole number but cannot be incremented(++) or decremented(--) or multiply by number etc., even though the variable stores the starting address of array? Eg
#include <iostream>
using namespace std;
int main()
{
int x[] = {12,33,41,55,68};
cout<<x<<"\n"; // Output : 0x7af786c84320
cout<<x+1<<"\n"; // Output : 0x7af786c84324
cout<<x+1000<<"\n"; // Output : 0x7af786c852c0
cout<<x-1000<<"\n"; // Output : 0x7af786c83380
cout<<x*1<<"\n"; /* Output : invalid operands of types
'int[5]' and 'int' to binary 'operator*' */
cout<<x*2<<"\n";
cout<<x++<<"\n"; /* Error : lvalue required as increment
operand */
cout<<x--<<"\n";
x=x; //Error : invalid array assignment
cout<<x<<"\n";
return 0;
}
It will be better if anyone can explain what happens when an array is declared in detail. And why among all arithmetic operation only '+' and '-' are valid not '*' or other.