Preliminaries
We will start our C programming jouney in earnest in the next chapter. In this chapter, we will look at some preliminary topics that provide a useful conceptual foundation when learning C, and computer programming in general. We will try and answer questions like:
- What is a computer?
- What is computer programming?
- What are programming languages?
- How do programming languages, and C in particular, work?
- What are some key, high-level attributes of C as a programming language?
At the end of this chapter, we will also look at the programming environment we will be using in this tutorial. Be sure to review it and make sure you have a similar setup on your computer so that you can follow along.
Why C?
But first, let’s address a concern some might have when starting to learn C:
Should we bother learning C in this day and age? Does it make sense to learn the C programming language now, more than 50 years after it was created? Is it still relevant, or is our time better spent learning a more “modern” programming language?
It is true that C was created more than 50 years ago, in the early 1970s. Compared to several other popular programming languages, it’s a relatively “lower level” language, in the sense that it is closer—in terms of the abstractions it provides—to the actual machines on which it runs.
In contrast, there are several “higher level” languages that can also be good choices for a first programming language. Like Java, or Python, for example. However, I think there will always be a strong case for C as a first language, because from a language design perspective, the elements of C are timeless!
Of course, there are good and not-so-great ways of learning computer programming, and the specific language you use plays a smaller part in the overall scheme of things. At the end of the day, a programming language is just a vehicle through which we learn important and useful—and also interesting, hopefully—ideas in computer science and software engineering.
What is a computer?
I’m sure you already have a fairly good idea of what a computer is. But computers are versatile, general-purpose machines, and they can be different things to different people. For some, it’s used for work; for others, its sole purpose could be to provide entertainment.
For our purposes here, we will take a view that suits a programming mindset better, and say: “A computer is an electro-mechanical, programmable machine.” I think the “electro-mechanical” and “machine” bits are easy to understand: a computer is a machine because it helps us humans automate tedious work, and it’s made out of electrical, electronic and mechanical components and parts.
The more interesting bit, at least in a programming context, is the “programmable” part. What does that mean?
What is computer programming?
Well, I’m sure you know what computer programming is, so there’s really no need to tell you anything at all about it! I think you are just going about doing this for fun, when you could already be building the next great app, right?
Well, I’m sure you know what computer programming is, so there’s really no need to tell you anything at all about it! I think you are just going about doing this for fun, when you could already be building the next great app, right?
Well, I’m sure you know what computer programming is, so there’s really no need to tell you anything at all about it! I think you are just going about doing this for fun, when you could already be building the next great app, right?
Well, I’m sure you know what computer programming is, so there’s really no need to tell you anything at all about it! I think you are just going about doing this for fun, when you could already be building the next great app, right?