Explain output

Explain the output anyone!

Saptarshi pal @saptarshipal
14 Jan 2015 02:52 pm

According to me, a and b should be the answer for 2 questions respectively. A simple diagram would be enough to understand it. If you follow it you will get this answer. Directions are from right to left.

Aparajita Mehta @aparajita
14 Jan 2015 07:29 pm

I am not able to understand the output of 2 ,3 , 4 if you could explain that would be very helpful. 

Saptarshi pal @saptarshipal
14 Jan 2015 07:45 pm

2)*--*++CPP+3 = During (1) CPP became CP+1, So ++CPP= CP+2 -> Then *(CP+2)= pointer to NEW i.e C+1. Then -- is there so C+1-1= C. After that *C+3= ER

(3)*CPP[-2]+3 Now CPP value is CP+2. So CPP[-2]=CP[0]. *CPP[-2]=*CP[0]=C[3]. After that C[3]+3=ST.

(4)CPP[-1]=(CPP-1)=CP[1], CPP[-1][-1]=CP[1][-1]=C[1]=NEW, Then C[1]+1=EW

Aparajita Mehta @aparajita
14 Jan 2015 11:35 pm

Thank u !!