C is a foundational Programming Languages, and is almost considered a lowest common denominator. It is used heavily in robotics embedded systems and simple microcontrollers like the PIC and Arduino. The Lego RCX can be made to support it. C was developed in 1972, by Dennis Ritchie at Bell Labs, and went hand in hand with Unix. It still retains a good relationship with modern related systems like Linux, Solaris and BSD.

C offers many concepts like procedural programming, that is, allowing a coder to group together statements into reusable functions, and libraries of functions. C has structures allow variables to be collected together, both for convenience in storage and manipulation, as well as being able to use those structures to closely reflect the structure of hardware registers. C headers can be used to prototype or specify the details of a functions type before the function is implemented.

C also offers preprocessing so that files may be included, and macros may be created and expanded. This preprocessor is powerful enough that it allows for conditional compilation. The concept is that in different compiling circumstances, only some parts of the code are actually compiled.

C has a standard library of routines for basics like memory allocation, IO, threading, mathematics and string handling. Note that this standard library may not be available on every platform, and platform designers and third parties may provide replacement libraries as well as additional library functions.

Strings are not it’s strongest point, and C is still best suited to low level functionality, that is, the code that needs to sit closest to the machine. It has been referred to as portable or readable assembly code. C is statically typed, and is generally a compiled language, compiled down to machine code binary, or some intermediate bytecode format.

The death of C has been predicted many times, although it has a habit of living on for it’s sheer flexibility and being so close to the system. Indeed, it may outlive it’s successor C++, as while C++ is superseded by further higher level languages, there is nothing quite like C when low level interaction is required.

C programs can often be made of many different C files. Good programming practice normally means separating a group of regularly occurring or similar actions into functions, and then grouping related functions into their own C source files with headers to match them. This will then mean that more than one file needs to be compiled. IDE’s for C often have their own project system which allows many files to be compiled from one build operation. There is also the common makefile system which uses a file to instruct the system what needs to be built and when.

If you would like to use GCC on your system, it is highly recommended that you do not purchase a PIC and look around at alternatives like the Atmel AVR, or the 8051.

  • NQC - Not Quite C - a C like programming system for the Lego RCX
  • BrickOS - Another way to program C with a Unix like OS for the RCX