Learn to Code With C – The MagPi Essentials

Categories:

Recommended

The C programming language was invented in the early 1970s, and since then has become one of the most popular and widely used general purpose languages. It’s used by a wide range of programmers, from amateurs working on simple projects at home, to industry professionals who write in C for a living. It’s been used to program everything from the tiny microcontrollers used in watches and toasters up to huge software systems – most of Linux (and Raspbian itself) is written in it. It can give you control over the smallest details of how a processor operates, but is still simple to learn and read. This series is an introduction to programming in C for absolute beginners; you don’t need any previous programming experience, and a Raspberry Pi running Raspbian is all you need to get started.

What’s so great about C?

C is a very powerful language – there’s not much you can’t use it for – but it’s fairly simple. The language itself only has 20 or so keywords, but there’s a huge library of additional functions that you can call in when you need them. In this series, we’re going to concentrate on learning about the keywords, with a few of the more useful library functions thrown in for good measure.

Many of the languages that you may have seen, such as Python, are what are called interpreted languages. This means that the code you write is run directly: each line of code is read in and interpreted as you run it. C is different: it’s a compiled language. This means that the code you write, known as the source code, is never run directly. The source code is passed through a program called a compiler, which converts it into a machine-readable version called an executable or a binary; you then run the resulting executable.

This may seem complex, but it has a few big advantages. First, it means that you don’t need to have a copy of C itself on every computer you want to run your program on; once compiled, the executable is stand-alone and self-contained. Second, the compilation process will find a lot of errors before you even run the program (but it won’t usually find all of them). Most importantly, the compilation process means that the time-consuming translation of human-readable code into machine-readable instructions has already happened, which means that compiled code generally runs many times faster than interpreted code would.

Category:
Tag:

Attribution

Simon Long. Learn to Code With C – The MagPi Essentials. https://magpi.raspberrypi.com/books/essentials-c-v1

VP Flipbook Maker

Display your work with VP Online Flipbook Maker! It is a professional tool supports conversion and creation of digital flipbook. Try it now!