C Icon

C

C is a general purpose programming language that first appeared in 1972.
2 Stories
All Topics

Ars Technica IconArs Technica

“A damn stupid thing to do" (The origins of C)

Ars Technica goes long form for this (abridged) history of the C programming language.

In one form or another, C has influenced the shape of almost every programming language developed since the 1980s. Some languages like C++, C#, and objective C are intended to be direct successors to the language, while other languages have merely adopted and adapted C’s syntax. A programmer conversant in Java, PHP, Ruby, Python or Perl will have little difficulty understanding simple C programs, and in that sense, C may be thought of almost as a lingua franca among programmers.

But C did not emerge fully formed out of thin air as some programming monolith. The story of C begins in England, with a colleague of Alan Turing and a program that played checkers.

If you have some downtime this week[end]… find a comfy spot, a hot drink, and enjoy a history lesson on one of the most influential and still extant programming languages of all times.

Cgithub.com

tic-tac-toe in a single call to printf

This was written for The International Obfuscated C Code Contest 2020 and I have zero idea how it works, but the entirety of the program consists of one call to printf

int main() {
    while(*d) printf(fmt, arg);
}

While its primary purpose is to serve as The One True Debugger, printf also happens to be Turing complete. (See “Control-Flow Bending: On the Effectiveness of Control-Flow Integrity” where we introduced this in an actual, published, academic paper. The things you can get away with sometimes.)

We ab^H^Huse this fact to implement a the logic of tic-tac-toe entirely within this one printf call (and a call to scanf() to read user input).

The code is beautifully formatted, too.

0:00 / 0:00