•  Back 
  •  C Language 
  •  Index 
  •  Tree View 
  •  Cross references 
  •  Help 
  •  Show info about hypertext 
  •  View a new file 
Topic       : C-Language Documentation
Author      : John Kormylo
Version     : C.HYP 1.0
Subject     : Documentation/C-Language
Nodes       : 233
Index Size  : 6362
HCP-Version : 3
Compiled on : Atari
@charset    : atarist
@lang       : en
@default    : 
@help       : Help
@options    : +g -i -s +x +z -t4
@width      : 75
View Ref-File[ Pointers ]

A pointer is a variable containing the memory address of another item.
To access the thing the pointer is pointing to (dereference), use the
unary '*' operator (see Unary Operators).

The type of the pointer depends on what it supposed to be pointing to.

  char *p;        /* p is a character pointer (char*) */
  void **v;       /* v is a pointer to a void pointer (void**) */

One can initialize a pointer with the address of global or static
variable (or a string constant);

When one increments a pointer, the address is incremented by the size
of the type being pointed to, so that

  (long) (p + i)  ==  ((long) p) + i * sizeof(*p)

where 'p' is a pointer and 'i' is an integer.  Consequently, one can
use array and pointer notation interchangeably:

  *(p + i)  ==  p[i]

See also Names, Pointer Arrays and Function Pointers.