Array Manipulation

Arrays can be treated as stacks. Therefore, things can be added or removed from either end of the stack. With the capability to add and remove things from the beginning and ending of an array, you can perform first-in-first-out and last-in-first-out functionality. Things can also be removed from the middle of a stack. With this in mind, take a look at the following five functions.

The push and pop Funtions

My wife told me that if I pushed her too far, she would pop me. This is not a reflection on our relationship, but a reminder of what push and pop do. Obviously she already had a lot to deal with, and I was adding to the end of her list. If I continued to do that, she would remove those things back off her list. Therefore, ...

Get Practical UNIX now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.