1/42
Looks like no tags are added yet.
Written with //
single line comment
written between /* and */;
multi line comment
Header file for input and output (cin, cout)
#include <iostream>
Lets you use cout and cin without the std:: prefix
using namespace std;
The function where program execution begins
main()
Ends every statement in C++
Semicolon (;)
Name of a variable or function; must start with a letter or underscore, with no spaces, no special characters, and not a keyword
Identifier
Data type for whole numbers
int
Data type for decimal numbers (single precision)
float
Data type for decimal numbers; more precise than float
double
Data type for a single character, written in single quotes like 'A'
char
Data type with the value true or false
bool
Sequence of characters written in double quotes
string
Declares a value that cannot be changed after initialization
const
Input stream; used with the >> operator
cin
Output stream; used with the << operator
cout
Moves the output to a new line
endl or \n
Gives the remainder of a division
%
Declared inside a function; automatic; destroyed when the function ends
local variable
Declared outside all functions; statically allocated
global variable
Copies the argument into the parameter; the original does not change
call by value
The position of an element in an array; always starts at 0
index
0 to size - 1 (for int a[5], indexes 0 to 4)
valid indexes
Using an invalid index; C++ has no guard against it, so it gives undefined behavior
array index out of bounds
ot allowed on arrays; you cannot copy (a = b) or compare (a == b) arrays directly, so use a loop
aggregrate operations
A collection of components of the same type arranged in rows and columns, like a table
2D array declaration syntax :: dataType arrayName[rows][columns];two dimensional array
Gives a type a new name; typedef int* IntPtr; then IntPtr p1, p2;
typedef
Special memory area reserved for dynamically allocated variables
freestore
A variable created with new and destroyed while the program runs
dynamic variable
Creates a dynamic variable in the freestore and returns a pointer to it
new operator
Special constant pointer value (actually the integer 0) given to a pointer that has no value
NULL
Destroys a dynamic variable and returns its memory to the freestore
delete operator
A pointer that no longer points to valid memory, such as after delete; set it to NULL to avoid problems
dangling pointer
A local variable that is created and destroyed automatically with the function call
automatic variable
A global variable
statically allcoated variable
An array created with new, e.g. d = new double[10];
dynamic array
A runtime problem that a program can detect and handle using try, throw, and catch
exception
Contains the code that might cause an exception
try block
Sends out a value to signal an exception
throw
Handles an exception; the parameter type must match the thrown value
catch() block
48 to 57
0 to 9
65 to 90
A TO Z (ALL CAPS)
97 to 122
a to z (mini)