2 weeks ago

Learn C with these Raspberry Pi resources

We look at the best resources for learning the venerable C programming language

The MagPi Essentials: Learn to Code with C 

This article first appeared in The MagPi 74 and was written by Lucy Hattersley

Learn to Code with C

£3.99/$5 or free PDF download

If you want to learn to program C using a Raspberry Pi, then the best place to start is with our official guide.

Written by Raspberry Pi’s very own Simon Long, the UX Engineer responsible for creating the Desktop on both Raspbian and Debian, this book is the perfect guide to C on the Raspberry Pi.
Simon has been programming with C since the early nineties and has created everything from mobile phones to medical equipment. The result is a compact and practical programmer’s guide, written from direct experience.

Starting with Hello World, the book covers everything from basic variables, strings, and arithmetic, through pointers (a subject many find difficult), and right up to file input and output.

What’s great about the Essentials Guide is that it’s a pocket-sized guide to the C language, packing in all the basics in 92 pages. Unlike many books on C, which run to thousands of pages, you get all the essential information and very little waffle.

Many members of The MagPi team find this book an invaluable reference guide, and keep a copy on hand whenever programming in C.

Online C courses

C Programming for Beginners

Udemy’s course, by Huw Collingbourne, is extremely beginner-friendly and provides easy-to-follow video tutorials. There’s a huge range of content. The RRP is £29.99, but you will periodically find it on sale (at press time it was £10.99).

Look out for special offers on Udemy’s beginner-friendly course

Programming Paradigms (Stanford)

This classic series of lectures by Stanford Professor Jerry Cain can be found on YouTube. The course teaches students how to write several programming languages, including C, and how to understand the programming paradigms behind each language.

Introduction to Programming in C

This four-week course by Duke University is designed to teach problem-solving with the C programming language. It’s not cheap (a subscription to Coursera is £37 per month), but Coursera certificates are recognised by many companies, so it’s a good option for those looking for a professional qualification.

CS50’s Introduction to Computer Science

Free

Massive open online courses (MOOCs) are online training schemes available for anyone to enrol in. We’re big fans of MITx, but Harvard has hands-down the best introduction to Computer Science with the C programming language.

Introduction to Computer Science

CS50 starts with Scratch and Python, but quickly switches to using C in a custom IDE as the basis for explaining computer concepts. It also features other technologies such as SQL and HTML.

Harvard says: “CS50x teaches students how to think algorithmically and solve problems efficiently. Topics include abstraction, algorithms, data structures, encapsulation, resource management, security, software engineering, and web development.”

CS50 is a challenging course, and towards the end you’ll have a comprehensive understanding of C. It’s a fantastic way to move from Scratch and Python to advanced coding in C.

Learn C The Hard Way

$29.99/£23.50

Few things divide the coding community as much as Zed’s programming courses. His ruthless, no-nonsense approach to learning eschews niceties such as developer environments and online interactive websites, instead throwing you into a text editor and the terminal.

Zed A Shaw does not pull any punches

This frank acknowledgement that programming “is hard” and that visual fluff distracts newcomers from actually learning is just the cold-water shock many programmers need. And nowhere is his course in its element more than when learning C (where you need to learn how to build, make, and run source code).

You can follow the courses online for free, but paying the charge gets you screencast videos, a PDF book, and free updates for life. Your editor loved this course so much, she paid up just as a ‘thank-you’.

Other resources

cplusplus.com

C++ is a more advanced programming language built on top of C, and cplusplus.com is the definitive guide. Within it, though, you’ll also find a great reference resource for C itself. Here you’ll find detailed information on functions, containers, and input/output commands. Just don’t get sidetracked by C++ until you’re ready.

Stack Overflow

You should set up a Stack Overflow account as soon as possible, no matter what language you’re learning. But this venerable site is especially helpful for getting answers to C questions. Use ‘[c]’ in your search term to get C-tagged results.

The C Programming Language

This book by Brian Kernighan and Dennis Ritchie, the latter of whom originally designed and implemented the language, is the definitive guide. The book itself is heavy-going, and you’re better off following a course when starting out. But it’s very handy to have around.