What is the difference between a[n+1] and a[n]+1 inside an array? -
i looked , looked on website find answer couldnt find anywhere.
however, difference?
here think.
say have array 5 elements in it, a[5]. a[n+1] second element, a[n+2] third, etc.
a[n]+1 be, type in number first element [n]. number 27, since a[n]+1 equal 28.
a[n]+ 1 takes value a[n] , adds 1 it.
a[n+1] takes value of n , adds 1 it.
bothe different in meaning context. a[n+1] index increment , value retrieval specified list , index. a[n] + 1 value retrieval specified list , index adding 1 it.
for example,
a = [1,2,3,4,5] n = 2 a[n+1] a[2+1] => a[3] => 4 a[n] + 1 a[2] + 1 => 3 + 1 => 4
Comments
Post a Comment