This month’s Exercise was originally how to create a structure pointer, fill it with data, and write that data to a file. It’s a procedure fraught with traps and peril. What’s even more challenging is when you’re presented with this type of code and it doesn’t work, but it’s your job to fix it.
Continue reading
Author Archives: dgookin
From Text to Hex
In last week’s Lesson, I showed a program that translates a string of hex values into ASCII text. This code was to sate the nerd in me so that when another nerd writes 48 65 6c 6c 6f 2c 20 66 65 6c 6c 6f 77 20 6e 65 72 64 21, I can respond accordingly. But to respond in hex, a second program is required, one that translates ASCII text into a string of hex values.
Continue reading
From Hex to Text
Do you speak hex? As a programmer, do you look at 0xF and see 1111 in binary? Do you see 15 decimal? What about the ASCII code? Do you know the letter for code 0x41? Are you that good?
Continue reading
Behold the Stack, Part V
Pulling in all the stack items mentioned in last week’s Lesson, I present to you a C program that emulates stack storage. I’m certain this presentation will be one of the highlights of your programming career.
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:
- The stack storage
- A stack pointer
- A function to push a value onto the stack
- 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
Ranking Scores – Solution
This month’s Exercise is to create an array of six players, assign each a random score (1 to 100), then display the player’s scores by rank. The first problem you most likely encountered was how to keep the player’s number and score together.
Continue reading
Behold the Stack, Part III
Whether you simulate a stack in your C code or just ignore the concept altogether, your program constantly uses the processor’s stack. Specifically, if the code contains a function, it uses this stack not only to call and return from the function, but to pass and return arguments as well.
Continue reading
Ranking Scores
In your fancy, new game, the program dutifully track players and their scores. When the game is over, or at the end of a round, the players not only want to know their scores, but where each sits in the overall ranking. That process takes a bit more coding than just spitting out the scores.
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
Behold the Stack, Part I

One of those weirdo programming concepts university sophomore programming students eagerly avoid is the stack. It’s a type of storage with unique features, but it’s difficult to appreciate unless you understand its origins.
Continue reading