Reputation: 89
I was reading some code and came across this thing. I don't have the whole context now save this line.
cout<<(*--*++ptr+1)<< endl;
this compiles fine and works when we input values in it..
its declaration is like this.
char ***ptr ;
What is this operator and is it included in the standard?
Upvotes: 1
Views: 106
Reputation: 400174
It's not a single operator, it's a combination of several unary operators. It gets parsed like this:
*(--(*(++ptr))) + 1
So, ptr1
is first incremented, then dereferenced, then that value is decremented and dereferenced again.
Upvotes: 7