paint-brush
Learn To Code in C with Nursery Rhymes and Fairy Talesby@sundae
229 reads

Learn To Code in C with Nursery Rhymes and Fairy Tales

by ShariDecember 27th, 2023
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

In this book, classic rhymes and stories you’re familiar with are “translated” into full C programs.

Company Mentioned

Mention Thumbnail
featured image - Learn To Code in C with Nursery Rhymes and Fairy Tales
Shari HackerNoon profile picture


When I wrote my first book, A Day in Code: An Illustrated Story Written in the C Programming Language, my goal was to create an unconventional programming book with the appearance of a regular storybook, but is actually written in code. C programming concepts are taught through code explanations. Since a standard picture book has 32 pages, I imposed the requirement on myself to make the book 32 pages, which is funny in retrospect.


Fast forward three years, and I released Learn C Programming through Nursery Rhymes and Fairy Tales that has 94 pages. In this book, classic rhymes and stories you’re familiar with are “translated” into full C programs. When you run the programs on your computer, the logic of the programs makes the text of the nursery rhyme or the fairy tale story print out on the console. Programs gradually increase in complexity, with simple nursery rhymes teaching a single topic, followed by more complex fairy tales combining multiple concepts. I think readers’ familiarity with the classic rhymes/stories will help with naturally understanding the logic of the programs. Of course, it’s also illustrated like a picture book to maintain a comforting storybook feel.


Learn C Programming through Nursery Rhymes


Compared to my first book, my objective with this new book was to delve deeper into code explanations, have longer programs, and add a few additional topics—including pointers, which allow you to access memory and directly manipulate it. Pointers are considered an advanced and difficult topic that beginners still must learn, as they are fundamental to the C programing language’s low-level memory control. Pointers are introduced in a program that tells the story of “The Three Little Pigs”, with each pig’s house being located at a memory address.


This book is a follow-up to my previous book, Learn Python through Nursery Rhymes and Fairy Tales. The “translation” of nursery rhymes and fairy tales into C programs was more challenging and space-consuming than Python. The biggest takeaway is that strings are much easier to work with in Python. Learn C Programming through Nursery Rhymes and Fairy Tales was made possible by using constants and variable names representing elements in the rhyme or story.

Learn C Programming through Nursery Rhymes

C is Useful

As an embedded software engineer, I’m a big proponent of C programming. It’s efficient and fast. It provides high level logical constructs like if…else and while() loops, while also being “close to the hardware” by allowing for low level manipulation of memory and bits. It has influenced many other programming languages like Python and Java, so provides a strong foundation for learning other languages.