The Resurgence of C Programming
Way back in the early 1970s, learning C was a rite of passage for many students. By today’s standards, it’s not a very high-level language. But back in those early days, long before the arrival of Java and Python, C was considered high level, especially when compared to assembly languages.
In the preface to their book The C Programming Language, Brian W. Kernighan and Dennis M. Ritchie note that C “is not specialized to any particular area of application. But its absence of restrictions and its generality make it more convenient and effective for many tasks than supposedly more powerful languages.”
To some degree, C was written for the purpose of elevating UNIX from a machine-level operating system to something resembling a universal platform for a wide range of software applications. Since its inception in 1972, C has been the common language of UNIX, which essentially means that it’s everywhere.
Example 1-1. C program to blink an LED on an 8-bit microcontroller with a 2,000-millisecond delay (adapted from the book AVR Programming)
/* Blinker Demo */
// ------- Preamble -------- //
#include <avr/io.h>
/* Defines pins, ports, etc */
#include <util/delay.h>
/* Functions to waste time */
int
main
(
void
)
{
// -------- Inits --------- //
DDRB
=
0
b00000001
;
/* Data Direction Register B:
writing a one to the bit
enables output. */
// ------ Event loop ------ //
while
(
1
)
{
PORTB
=
0
b00000001
;
/* Turn on first LED
bit/pin in PORTB */
_delay_ms
(
2000 ...
Get The Resurgence of C Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.