# [Solved] Please explain the output of this program based on pointers and strings?

Explanation line by line:

``````Striker=Track;
``````

Sets Striker to point to the memory of Track, so Striker[0] would be equals to Track[0].

``````Track[1]+=30;
``````

Increases the value of the second index of Track by 30 (Track[1] = 50).

``````cout<<"Striker >"<<*Striker<<endl;
``````

*Striker is the same as Striker[0], *Stirker+1 is the same as Striker[1] and so on. The output of this line is “Striker > 10” because Striker[0] = Track[0] = 10.

``````*Striker-=10;
``````

Decreases the value of the first index of Striker by 10 (Striker[0] = 0).

``````Striker++;
``````

Increases Striker pointer, so now Striker points to Track+1 (Striker[0]=Track[1], Striker[1]=Track[2], …).

``````cout<<"Next @"<<*Striker<<endl;
``````

Outputs “Next @50” because Striker[0]=Track[1]=50.

``````Striker+=2;
``````

Increases Striker 2 indexes. Now Striker=Track+3.

``````cout<<"Last @"<<*Striker<<endl;
``````

Outputs “Last @40” because the value of Striker[0] is equals to the value of Track[3].

``````cout<<"Reset To"<<Track[0]<<endl;
``````

Outputs “Reset To 0” because Track[0] changed to 0 when Striker[0] decreased (*Striker-=10).

All this pointers operations are explained in this tutorial:
http://www.cplusplus.com/doc/tutorial/pointers/

solved Please explain the output of this program based on pointers and strings?