Quick Course on C
Introduction
I’m assuming, first of all, that you have some clue how to
program and that you’ve done some programming in the past.
You should understand how variables, subroutines/functions, input
and output, etc. work in general; this is a whirlwind tour of C
that includes use of these features.
Do not expect to become proficient in C by reading quickly through
this. Learning C is like learning any language—you’ve got
to practice and play with it to get anywhere useful. If you’re
coming from an interpreted language like BASIC or PHP or Perl, you should
be fine going through this. If you’re coming from Java, for
heaven’s sake be careful once you get to anything more advanced
than basic variables. Pointers are real and can be dangerous and
frustrating beasties if you don’t know how to use ’em.
If you find a problem with this, or it doesn’t make any sense,
or some information in here is wrong and you’re sure it’s
wrong, you can e-mail me at ''@rutgers.edu... On to the meat.
Table of contents
- Introduction
- Variables and basic I/O
- Control statements
- Functions and prototypes
- Arrays, structures, and type definitions
- The C preprocessor
- Pointers
- File and stream I/O
- Esoterica
- Multiple-module development
Useful things
- Pointers on C (Not pointers in C, that’s section
7 of the tutorial.) Notes on stuff people’ll look for when
grading, and stuff that’ll make your code happier.
- Really advanced/esoteric stuff about GCC
- Standard C.
A reference to the standard C library.
- The GNU C Library.
A reference to the GNU C library (includes standard C).
- C Reference Manual. By Dennis Ritchie himself. This
covers the original version of C (much has been added or
changed), but it’s at least interesting to see whence we have
come.
- ANSI C Reference Card. Lots of stuff crammed onto two
8½-by-11 sheets, could be useful while programming.
- Your local manpages: man 2 FUNCTION will bring up the
manpage for a system call like open, creat,
and so forth; man 3 FUNCTION will bring up the manpage
for a library call like printf or strcpy.
If neither of these works, try just man FUNCTION, but
it may bring up the command-line version of FUNCTION.
- If all else fails,
- C: A Reference Manual (book). Fairly useful quick-reference
for ANSI C. It’s been around for a while in various
forms/editions.