UWA Logo Computer Science & Software Engineering
C Programming (CITS1210) - Lecture 8
 
    CITS1210  |  help1210

A slow introduction to pointers in C

The ISO-C99 programming language has a very powerful feature, which we'll casually term "pointers in C" for now.

  • If used correctly pointers can enable very fast, efficient, execution of C programs.
  • If misunderstood or used incorrectly, pointers can make your programs do very strange, often incorrect, things, and result in very hard to diagnose and debug programs.

The primary role of pointers - to allow a program (at run-time) to access its own memory - sounds like a useful feature, but is often described as a very dangerous feature.

There is much written about the power and expressiveness of C's pointers, and much (more recently) written about Java's lack of pointers.

More precisely, Java does have pointers, termed references, but the references to Java's objects are so consistently and carefully constrained at both compile and run-time, that very little can go wrong.


C Programming (CITS1210), Lecture 8, p1, 25th September 2008.