C - Reference Card
C - Reference Card
while Loop Example A pointer variable (or just pointer) is a variable that stores a
C++ Data Types memory address. Pointers allow the indirect manipulation of
data stored in memory.
Data Type Description
boolean (true or false) Pointers are declared using . To set a pointer's value to the
character ('a', 'b', etc.) address of another variable, use the operator.
character array (C-style string if
terminated) Example
C++ string (from the STL)
integer (1, 2, -1, 1000, etc.)
do-while Loop Example
long integer
single precision floating point
double precision floating point
Use the indirection operator ( ) to access or change the
These are the most commonly used types; this is not a
value that the pointer references.
complete list.
Example
Operators
The most commonly used operators in order of precedence:
1 (post-increment), (post-decrement)
2 (not), (pre-increment), (pre-decrement) for Loop
3 , , (modulus)
4 , Array names can be used as constant pointers, and pointers
5 , , , can be used as array names.
6 (equal-to), (not-equal-to)
Example
7 (and)
8 (or)
9 (assignment), , , , ,
Example
Console Input/Output
console out, printing to screen
console in, reading from keyboard
console error Dynamic Memory
Example: Allocate Memory Examples
Functions
Functions return at most one value. A function that does not
return a value has a return type of . Values needed by
a function are called parameters.
File Input/Output
Example (input): Deallocate Memory Examples
Structures
Decision Statements Declaration Example
if Example
Definition Example