Next: Structures, Previous: Type Size, Up: Top [Contents][Index]
Among high-level languages, C is rather low-level, close to the machine. This is mainly because it has explicit pointers. A pointer value is the numeric address of data in memory. The type of data to be found at that address is specified by the data type of the pointer itself. Nothing in C can determine the “correct” data type of data in memory; it can only blindly follow the data type of the pointer you use to access the data.
The unary operator ‘*’ gets the data that a pointer points to—this is called dereferencing the pointer. Its value always has the type that the pointer points to.
C also allows pointers to functions, but since there are some differences in how they work, we treat them later. See Function Pointers.
• Address of Data | Using the “address-of” operator. | |
• Pointer Types | For each type, there is a pointer type. | |
• Pointer Declarations | Declaring variables with pointer types. | |
• Pointer Type Designators | Designators for pointer types. | |
• Pointer Dereference | Accessing what a pointer points at. | |
• Null Pointers | Pointers which do not point to any object. | |
• Invalid Dereference | Dereferencing null or invalid pointers. | |
• Void Pointers | Totally generic pointers, can cast to any. | |
• Pointer Comparison | Comparing memory address values. | |
• Pointer Arithmetic | Computing memory address values. | |
• Pointers and Arrays | Using pointer syntax instead of array syntax. | |
• Low-Level Pointer Arithmetic | More about computing memory address values. | |
• Pointer Increment/Decrement | Incrementing and decrementing pointers. | |
• Pointer Arithmetic Drawbacks | A common pointer bug to watch out for. | |
• Pointer-Integer Conversion | Converting pointer types to integer types. | |
• Printing Pointers | Using printf for a pointer’s value.
|
Next: Structures, Previous: Type Size, Up: Top [Contents][Index]