\documentstyle{guidemacros}
\begin{document}
%%header and stuff here

\section{Should you read this document?}

This document is for people who have learned C to the point where they
understand procedures, global and local variables, printf, and the
like, but do not understand what {\tt*foo} and {\tt\&bar} mean or even
if they {\em do} understand their meaning, find themselves adding and
subtracting {\tt*}s to make the compiler happy, or guessing whether
or not the values will still be around after the function returns, or
wondering how and when to use {\tt malloc}.

\section{What is a pointer?}

A computer organizes its memory by numbers.  Each byte is referenced
by a number called an {\bf address}, or {\bf location}.  When you
write, in a C program:

\begin{verbatim}
int quux;
\end{verbatim}

the compiler creates a relationship between the variable name {\tt
quux} and some unused amount of memory, referred to by address number
({\tt quux}, for instance, might be assigned to the addresses from
{\tt 13523} through {\tt 13526}\footnote{On most systems, an integer
uses 4 bytes.}).  When you tell it:

\begin{verbatim}
quux = 5;
\end{verbatim}

the computer looks up the variable name {\tt quux}, finds it
corresponds to the addresses {\tt 13523} through {\tt 13526}, and
writes a ``5'' there\footnote{The actual scheme that is used to record
an integer is system-dependent.  Some write {\tt 0,0,0,5}, some, {\tt
5,0,0,}, others {\tt 0,5,0,0}, and any other permutation you can think
of.}.  Similarly, ``5'' is said the be the {\bf value} stored at {\tt 13523}.

A variable, as you may know, can contain an integer, a float, a double,
a character, and so on.  A variable may also contain the address of
another variable.  Suppose your code had:

\begin{verbatim}
foo = &quux;
\end{verbatim}

Then the value of {\tt foo} would be {\tt 13523}.  In that case, {\tt foo}
would be called the {\bf pointer} to quux.

\section{\& and *}

From this, you might conclude that {\tt \&} means ``the address of''
(and you'd be right).  The opposite of {\tt \&} is {\tt *}, that is,
``the value of''.  For instance, in the example above, {\tt *foo==5}.

Now {\tt foo}, itself, is stored in memory, and has an address, too.
This address can be assigned to another pointer:

\begin{verbatim}
bar=&foo;
\end{verbatim}

Then {\tt *bar} would be {\tt foo} and {\tt **bar} would be 5.

\section{Declaring pointers}
\section{Null pointers}
\section{Lists and trees}
\section{Arrays}
\subsection{Double arrays}
\subsection{Passing arrays to functions} %no need & and dbl arrays
\section{Allocating memory}
\subsection{When do you need to allocate memory?}
\section{Local variables and pointers}
\subsection{How can a function change a variable passed to it?}
\subsection{Example: scanf}
\subsection{Passing pointers or values?}
\section{What's a segmentation violaton?}
