0
Help me please!
So here is the code #include <iostream> using namespace std; int main() { int Number[]={2,4,8,10}; int *ptr=Number; for(int C=0;C<3;C++) {cout<<*ptr<<"@"; ptr++; } { cout<<endl; for(int C=0;C<4;C++) {(*ptr)*=2; cout<<Number[C]<<"#"; --ptr; }} cout<<endl; return 0; } Please somebody explain me the work of that --p. I understood the p++ for increment but I'm unable to relate the same with --p. When I run it the output comes out to be 2#4#8#16#20# for --p part. Please explain it to me with the help of the given output. Thank you
1 Antwort
+ 1
p++ increments at the end of the loop, p-- would decrement at the end of the loop. Placing the -- symbol before p, such as --p, means that before the loop takes place, p is decremented by 1.