Acorn logo

C from the Top

As part of a major new series with Archive Magazine, I have produced an entire series of C tutorials which go through from the very basics, right up to WIMP programming in C.

With the permission of Paul Beverley, I am placing both a HTML and the original Impression version of each tutorial shortly after they are published. I shall also include the tutorial files as downloads.

I should thank Matthew Phillips here for helping me proof check all the tutorials, for making suggestions and pointing out when the code I've put up here has been wrong

WARNINGS!

For those who are reading the tutorials and not using RISC OS machines, please remember one thing. This set of tutorials are designed for those who have never dabbled in C and have been designed in such as way as to introduce the concepts without being frightening. Some of the code I have used would not be used by those programming for work (especially the use of gets) but it has been used here for demonstration purposes.

Also, in the downloads, the software in the compiled directory inside the archives will only run on RISC OS based machines (such as the Acorn range and RiscStation machines) - they will 100% not run under DOS/Windows/MacOS/Linux or BSD.

Anyhoo, here's the first part......

Part 1 - The basics

In this part, the printf and scanf functions are covered along with a few definitions. Rather than doing a very dull Hello World program, we play around a bit. Click here for the HTML version or here for the download

Part 2 - Variable types

Here we deal with the different variable types and compare them with how BBC BASIC uses the same variables. It covers also the re-assigning of a variable type (e.g. from int to float) as well as giving a few practical examples. See it here or alternatively, download it first

Part 3 - Getting the flow

In the third installment, we are introduced to flow - the likes of then..else switch and case, ? and any other flow directives within C. The full piece is here for your delight or here for the Impression version

Part 4 - Strings 'n' Stuff

In which we get around to some simple string handling and start to create a real application. It's here for the html version or here for the download

Part 5 - Pointing and functions

This section covers pointers and the different types of functions, function protocols and prototypes. Visit here for the web-based version or here for the Impression version

Part 6 - Arrays and more printing

Here, the idea of how an array works, accessing array elements and a few other bits are introduced as well as more advanced bits using printf(). View it here on the web or for those with Impression, download it

Part 7 - Functions and recursion

What makes up a function? In the seventh of the fifteen tutorials, we explore the makeup of a function and how function recursion works. Fancy a look-see, well clicking here will let you, while those wanting to read off line click here and you can have the Impression version.

Part 8 - Saving and Loading

This is the first of two parts looking at how the filer works under C. The first part explains how the filer works and which functions are needed for opening and closing as well as reading and writing. Here is the html version while the Impression version is here

Part 9 - The filer II

More advanced functions this time such as fprintf,fscanf as well as random access. If you were to click here you could read it online. Offline though, you should click here

Part 10 - Structures n Unions

You can normally associate hot water, ground beans, milk and sugar as coffee and calcium, chromium, zinc and uranium as elements - but how would you do that in C. It's all explained here or in Impression format, here

Part 11 - What's in a name?

I cover typedef,enum and bitwise operations in this installment. For a better look, try here or for Impression folks, click here

Part 12 - Preprocessor-terous

In which the wonderful world of the compiler's preprocessor is examined....HTML here, Impression here

Part 13 - Function pointers

void* functions as well as pointers to functions are looked at here and in particular what advantages they may have over switch...case structures. Click here for the web version, and here for the Impression download

Part 14 - Remember you're a ........

Memory. Forgetting things.... can't remember what day it is..... can't remember where you left your false teef? Well, in C we have a way of avoiding these. Now if you clicked here the secrets shall be revealed online, off line though, here is a good place to click for the Impression version

Part 15 - The left overs

In the final tutorial, we cover variable modifiers, storage class specifiers and sprintf(). For this, click here while Impression users, can click here


Chemistry software

Maths

Languages

Back to the software page

BBC B software

The BSc thesis

The HNC project

Help with de-archiving the self extracting archive