Comparing Three Items

Logic can be frustrating, especially for non-Vulcans. The computer is kind of a Vulcan, so logic comes naturally to the machine. Programming languages are packed with logical expressions. A programmer’s duty is to convert human thoughts into the raw, powerful logic the computer understands — and end up with the desired result.
Continue reading

Behold the Stack, Part IV

To simulate stack storage in a C program, you need to emulate the four basic parts of a stack:

  1. The stack storage
  2. A stack pointer
  3. A function to push a value onto the stack
  4. A function to pop a value from the stack

Further, you need to implement controls that prevent a stack overflow or underflow. And you can get real fancy, but those four items are the basics.
Continue reading

Behold the Stack, Part II

At the lowest programming level, you encounter machine code. This is the language of the processor itself. Machine code directs the processor to do things, such as read from or write to memory, store data, perform math, and other tasks. And if you dare to program a processor directly, you’ll encounter something called the stack pointer register.
Continue reading