February 2020
Beginner to intermediate
616 pages
15h 16m
English
First, we will apply the mod 10 operator to separate our digits. Assuming the number entered by us is 153, you can see that 153 is divided by 10 and the remaining 3 is pushed to the stack:

The value in the stack is pushed at the index location indicated by top. Initially, the value of top is -1. It is so because before the push operation, the value of top is incremented by 1, and the array is zero-based, that is, the first element in the array is placed at the 0 index location. Consequently, the value of top has to be initialized to -1. As mentioned, the value of top is incremented by 1 before pushing, that is, the ...
Read now
Unlock full access