C Language Programming Resources (OBSOLETE - 2001)

This is an obsolete circa year 2001 page that deals with programming in C. Many of the links are old and broken.

Is Clarity More Important Than Correctness?
If your program is clear you can make it correct.
Can you be sure your program is correct if it isn't clear?

- J. Blustein <jamie@csd.uwo.ca>, How to Debug.


Daniel from Camp Nazareth out in Minnesota suggested this: The Many Languages of IT Programming

Algonquin C Programming Information (circa 1999)

These first items are selected to be of use to people writing programs in the Algonquin environment in 1999.

Help with debugging

This is made obsolete with the VALGRIND software under Linux.

You can make sure all your malloc/free function calls are matched by using the MEM software package. It replaces these C Library function calls: malloc, calloc, realloc, strdup, and free. Select here for details. You can pick up the software itself by selecting here.

Modern environments use valgrind to debug memory leaks.


-   Compiling at home and at Algonquin: How to do it!
-   Creating a DOS executable (to enable redirection) in Turbo C and Borland C.
-   Catching Integer Overflow: How to do it.
-   Changing the Run-Time Stack and Heap Size: Check this out if you have a large program that keeps faulting. You may be running out of internal heap or stack space.
-   Defensive C Programming: Avoid C traps.
-   Robert Allison of Algonquin College describes how to write C programs.
-   Improving and Fixing C Code, using examples from Algonquin student assignments.
-   Different ways to write Zero in C

Highlights and Excerpts from the WWW

These are items that I think C programmers should see.

Rob Pike on C program style.
A program is a sort of publication. It's meant to be read by the programmer, another programmer (perhaps yourself a few days, weeks or years later), and lastly a machine. The machine doesn't care how pretty the program is - if the program compiles, the machine's happy - but people do, and they should.
Henry Spencer's 10 Commandments of C Programming
...Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end...
An excellent C topic reference
This points to many useful topics about C programming, including a bit of C history such as the B programming language that I used before I learned C: B didn't believe in type­checking, period. There was only one type, the machine word, and the programmer was responsible for applying to a variable only such operators as made sense.

C on the World Wide Web

-   Steve Summit's Introductory C course. (highly recommended!)
-   Programming and Unix tutorials
-   A mirror of Introduction to Object Oriented Programming Using C++: a tutorial on programming in C++, sponsored by the Globewide Network Academy [GNA] of free Internet courses
-   Frequently Asked Questions about C programming.
-   Lysator Computer Society's Hotlinks to C Resources
-   Ten Gotchas of the C language
-   Information sources include:
-   The lysator library.
-   Learn C/C++ today page maintained by Vinit Carpenter
-   Archive of the C Users Journal.
-   The C Side by Derek Harper.
-   *c:c++ resources by E.J. Inglis-Arkell.
-   Coding standards include:
-   Recommended C Style and Coding Standards by L.W. Cannon et al.
-   C language courses/references include:
-   Introductory C Programming by Steve Summit.
-   C Programming at the Central Institute of Technology, New Zealand.
-   Programming in C by Dave Marshall, University of Cardiff.
-   C Programming by Steve Holmes, University of Strathclyde.
-   Introduction to C Programming by Marshall Brian.
-   Introduction to Programming in C at Worcester Polytechnic Institute.
-   Phil's C Course by Phil Ottewell.
-   C Programming Language Information by J Blustein.
-   Introduction a la programmation en ANSI-C by H Faber, (French).
-   Other bits and pieces:
-   The SNIPPETS collection of C/C++ code by Bob Stout.

Security Issues in C Programs

The Internet is full of security incidents arising from code that forgets to check for buffer overflow. This is a serious programming error, and I don't accept student code that does not protect itself against overflowing its own internal buffers. Check the size of the buffer before you append anything to it!

-   CERT security advisory concerning failure to handle sign-extension in characters
-   CIAC security advisory concerning failure to check for input buffer overflow
-   AUSCERT security advisory concering failure to check for input buffer overflow
Buffer overflows appear to be the most common problems reported
in May, with denial-of-service problems a distant second. Many
of the buffer overflow problems are probably the result of careless
programming, and could have been found and corrected by the vendors,
before releasing the software, if the vendors had performed elementary
testing or code reviews along the way.

C oddities

The International Obfuscated C Code Contest has some prime examples of how to write very confusing C code.

Once you think you understand loops and switch statements, see Duff's Device.

Internet Free Zone Level 1 logo Support free and non-commercial Internet.
Valid HTML 4.01 Strict Any Browser logo This site works best in Any Browser, a campaign for non-specific WWW.
Creative Commons License logo This work is licensed under a Creative Commons License.
Hacker Ideals Emblem The real definition of Hacker

Page Author and Webmaster: Ian! D. Allen idallen@idallen.ca