You can't use copy and paste code from the internet for a stack and expect it to meet your assignment: you need to use an array in a different way.
You need two indexes:
together with the functions your teacher describes:
Because your array size if defined for you - 10 elements - your
indexes should start from 0 and 9 respectively.
functions are simple: they check if the appropriate index is at it's starting value.
is also simple is the right index smaller than the left index?
The push and pop operations are very similar to those you found, but with the "right" ones going "downwards" instead of up.
Give it a try: this isn't complicated - if you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide