3 minute read
Learn C
Learn C with Raspberry Pi
Learning how to code in C will also teach you the underlying principles of computing. By Phil King
Advertisement
CREATOR
An Introduction to C & GUI Programming
Simon Long
Price: £10 / $12
magpi.cc/guibook Not only does this 156- page official guide offer an introduction to learning C on Raspberry Pi, it shows you how to start creating graphical user interfaces with it.
Aimed at beginners, the first half of the book teaches you the basics of writing simple command-line programs in C. Starting with Hello World, it covers everything from basic variables, strings, and arithmetic, through pointers (which learners often find difficult to grasp), right up to file input and output. Unlike many books on C, which can
run to thousands of pages, you get all the essential information in a compact format with no waffle.
Once you’ve worked through those chapters (or if you have previous experience using C), you are ready for the second half of the book, which shows how to use the GTK user interface toolkit with C to create featurerich GUI applications that can be run on the desktop. You start with handling user input with buttons and menus, before moving on to more advanced UI features such as data stores and dialogs.
Books to read
Study these guides to learn the language
C PROGRAMMING ABSOLUTE BEGINNER’S GUIDE
Ideal for complete beginners, its 352 pages take readers step-by-step through all the concepts with great clarity and numerous code examples. By the end, you’ll have a good grasp of the language.
magpi.cc/cpabg
PROGRAMMING IN C
Stephen G Kochan’s epic 544-page tome covers everything from the fundamentals to advanced topics in great detail and features practical examples. An ideal companion for an online course.
magpi.cc/ckochan
C PROGRAMMING LANGUAGE
Co-written by Dennis Ritchie, the creator of the C language, this book (aka ‘K&R’) has long been viewed as the definitive tome for learning C. A little heavy-going, but a trusty reference guide.
magpi.cc/kandr
CREATOR
CREATOR
Learn-C.org
Ron Reiter
Price: Free
learn-c.org While not a comprehensive guide to C (it’s still under construction), this free set of online tutorials is aimed at
complete beginners. As one of a series of Interactive Tutorials sites covering different languages, the vision is to teach
Learning to code from a video isn’t always recommended, but it can complement written
and interactive resources. With a running time of nearly four hours, this YouTube tutorial from CodeCamp.org takes you through the basics of the C language. The on-screen narrator has clear diction and explains the concepts in detail, while the enlarged code window appears in the background.
coding within the browser using short and effective exercises. By running actual code directly from the browser – with windows for code and output – learners can try out programming and focus on just that, without having to set up a coding environment locally.
Starting with a simple Hello World example, the Basics section takes learners through topics such as variables, arrays, strings, and functions. The Advanced section moves on to more complex concepts such as pointers, recursion, and binary trees. It should give you a solid
C Programming Tutorial for Beginners
CodeCamp.org
Price: Free
magpi.cc/codecampc
grounding in C.
Following an introduction and how to set up everything you need for C on Windows or macOS, you’re straight into a Hello World example before moving onto standard topics such as variables, data types, functions, and pointers, along with the creation of a simple calculator and game. A handy list of topics underneath enables you go straight to the section you want.
Online courses
Learn C with these interactive courses
CS50’S INTRODUCTION TO COMPUTER SCIENCE
This free massive open online course (MOOC) from Harvard University is a popular starting point for beginners to programming. Most of the content is in C, and there’s a cloud-based IDE for coding.
magpi.cc/cs50
INTRODUCTION TO PROGRAMMING IN C
Duke University’s four-part course aims to develop strong programming fundamentals for learners who want to solve complex problems by writing programs. You’ll need to sign up to Coursera (£38 per month).
magpi.cc/dukec
ADVANCED C PROGRAMMING: POINTERS
Want a few extra pointers on how to use pointers in C? This focused Udemy course explores the tricky topic in great detail, although it’s not aimed at beginners. Code examples are provided.