From all the sources I've read, they say - the difference between peek and pop is that peek doesn't remove the top value. In the provided example from my lecture notes, apparently they do the same using a different method of subtraction. After both operations top has 1 subtracted.
Am I right? Probably not, can somebody explain how do those differ?
int pop(void)
{
assert(top>0);
return data[--top];
}
int peek(void)
{
assert(top>0);
return data[top-1];
}