It’s not really a thing done in C, although you could do. I came across a site that offers commercial Interactive Fiction. As they put it “text-based, multiple-choice games. ” and “By using text, we can interact with the imagination in different ways from a graphics-based game. We can also allow game designers to quickly and inexpensively produce games in comparison with graphics-based games.”.
Their games aren’t free but aren’t that expensive either typically $5-$8 or thereabouts and you can get them on mobile as well as via Steam. A recent game they’ve just launched has 1.2 million words of text (that includes the game scripts) which is phenomenal considering that most novels are 50,000-90,000 words. Their games use their own open source scripting language called ChoiceScript which is a very simple programming language. You can read their online manual (over three web pages) which should take maybe 20 minutes long. You can also play some of their games partly or fully free on the web.
The games are put together through a series of scripts. There’s also a free IDE for creating the scripts from a 3rd party. If you think writing a book is hard then writing an IF (Interactive Fiction) game must be like that but on steroids.
Games like the 1.2 million words one have multiple paths through with different plot lines which aids replayability. This isn’t anything like the Fighting Fantasy books (Name drop: I worked on a football game for Ian Livingstone in the mid 90s) because ChoiceScript has variables. This means that characteristics can improve over time and you can make decisions using <. >, <=, >=,==,!= just like in C etc. It doesn’t have arrays (there seems to have been some attempt at adding them in 2015 but I suspect it didn’t work) but there are subroutines and Goto which lets you create a structure.
You can add graphics but the games I’ve looked at don’t use them much if at all. The pictures are painted with words and this company have a very wide variety of games on sales including RPG, superheroes, science fiction, mysteries, war and pirates amongst others. The game mechanics are multiple-choice questions which doesn’t sound very glamorous but its like reading a book; your mind fleshes out the backdrop. The original Colossal Cave Adventure game is an example of Interactive Fiction and not coincidentally the Awards for Interactive Fiction are called the XYZZY Awards.
As the saying goes “Everyone has a novel in them”. IF is one way to bring it out…