+ 1
Why does this code gives 57 as output??
3 Answers
+ 1
n_ptr+5 coincidentally holds the value 0, so (n_ptr+*(n_ptr+5)) equals n_ptr+0 and points to the first element of the array
+ 1
But when this statement is given,
printf("%d",*(n_ptr+*(n_ptr+4)));
The result is 0.
Why is it so?
+ 1
You define an array with four elements and try to access its fifth element. The memory location could contain anything, possibly a trash value, possibly another variable's value. You can't really predict the outcome