hello,
in the following question
c=4;
d= (++c)++; //It works in gcc compiler
d= (c++)++; //it didn't work
what i have read that ++c or c++ returns a value which can't be again incremented or decremented (like 5++).
i want to know how the first statement works and second statement do not?
please help me in this question.........

Prefix increment/decrement operators return lvalue (a reference to operator argument in C++ terms) so it's possible to increment/decrement this lvalue. Postfix increment/decrement operators return rvalue (a value as is, not a reference to) so it's impossible to increment this value (it's not a variable).

what i have read that ++c or c++ returns a value which can't be again incremented or decremented (like 5++).
.

You have read wrong.
You are though right by saying both of these operator returns a vale, but the pre-fix(++x) return that value by reference. That means it can be on the left side of assignment operator.

//although the code is meaningless but then too..........
int i=1,y=0;
i++++;
cout<<i;

Search what do Return by reference means

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.