Why C is not a good first language

More and more institutions teach C, or even C++, as a first computer language. There follows some comments on why I (in a personal capacity!) do not think this is ideal.

Consider the traditional first program: `Hello, World', in ANSI C and FORTRAN90:

#include <stdio.h>

int main(void)
  printf("Hello, ANSI C world.\n");
program hello
write(*,*) 'Hello, F90 world.'
whereas one can reasonably explain every line of the FORTRAN90 example, whilst wishing it was the one-line BASIC version, explaining every line of the C code is much harder. Indeed, I know people who have spent years programming in C and still cannot understand the difference between an #include statement and specifying a library to the linker! The need to grapple with the syntax for a function definition before the simplest program runs does not help either.

I regard C as an excellent second language, after one is already comfortable writing simple programs and one knows what a function is, and one is beginning to curse BASIC or FORTRAN77 for their lack of function prototypes. As a first language I find it off-putting and too full of punctuation.

MJ Rutter, August 2000. Return to contents