Integer
64
64
64
64
Floating point decimal
64.0
Double precision floating point decimal
64.0
Character
"a"
Boolean
true
Addition
Unary positive, makes number positive
Subtraction
Unary negative, makes number negative
Multiplication
Division
Modulo (remainder of division)
Increment
x++;
Decrement
x--;
Equals
a+=b is a=a+b
a-=b is a=a-b
a*=b is a=a*b
a/=b is a=a/b
a%=b is a=a%b
Is equal to
Is not equal to
Greater than
Less than
Greater than or equal to
Less than or equal to
Bitwise AND
Bitwise OR
Bitwise XOR
Arithmetic shift left (shifts all the bits one space to the left, essentially multiplying it by 2)
Logical shift right (shifts all the bits one space to the right, essentially dividing it by 2)
Bitwise NOT
AND operator
OR operator
NOT operator
Insertion operator,
Links related expressions together
Unary operator that returns how many variables in RAM a variable holds
Denotes relation of an object to a struct
Denotes an object is an array during declaration, also holds the array's size, unless being initialised
int numbers[4];
References a array's index
numbers[3]
Denotes parameters of a function
Denotes a function
f();
Denotes a parameters when initialising a new instance of a class
Class objectName("parameters");
Defines a block
Initialises an array
int numbers[] = {0, 1, 2, 3};
Initialises a variable through brace initialisation, which assigns default values on empty brackets and prohibits illegal conversons
int n {64};
Used for switch cases
Used for separating true and false returns in conditional expressions
retval = exp ? trueret : falseret
Used for labelling different access levels of a class
Used for separating condition and return values in conditional expressions
retval = exp ? trueret : falseret
Denotes relation of a pointer to a struct instance variable
Unary delcaration of a pointer variable or function; that reads the value in the assigned memory address
Unary dereferencing (associating a pointer to an address)
*p
Pointer typecasting; enforcing a pointer type
Unary memory address of a variable
&x
Referencer; provides an alias for a variable
int& x
Denotes imported module file
#include <iostream>
Denotes wrapper type for calling functions with a template
Declares a string
Declares a string
Declares end of a line of code
Declares multiple arguments
double average(int number, ...) {
Finds the size of a datatype
(int *) malloc(sizeof(int));
Finds the size of a variable in bits
int y = sizeof(5+2);
Declares an alias for a type name
using number = int;
Declares a namespace; a default class to resolve methods and objects from if a class prefix is not specified
using namespace std;
Declares a template; a generic datatype for a class or function
template <typename T> void functionName(T object) {
Declares automatic type; determines type based on context
Used for declaring new objects from a class in "Java style"
Class* obj = new Class(parameters);
Used for freeing objects created by "Java style"
Declares a class
Used for declaring private classes or methods, that cannot be interacted with by other classes
Used for declaring public classes or methods, that can be interacted with by other classes
Object representing zero address
Declares doubles (also known as floats, or numbers with decimal place)
Declares a structure; which defines public custom datatypes similar to a class, but without methods
typedef struct {
code;
} Foo;
Declares integers
Goes to a label
Executes code if condition is true
if (condition) {
code;
}
Used for declaring that a method does not return a specific value
Used for declaring a variable, but not defining it
Declares a static variable; a variable that retains its value outside of its scope
Loops code while a condition is true
while (condition) {
code;
}
do {
code;
}
while (condition);
Loops code for a set amount iterations or for every object in list
for (initialization; condition; update) {
code;
}
Used for storing value in a CPU register (I think this is deprecated, but wow)
for declaring loop in a while loop
Executes code when if or else if isn't executed
Imports classes and modules
Terminates a function, returning a value
Used to tell compiler to complete the next iteration of a loop
Switches logic flow based on an output
switch (expression) {
case x:
code;
break;
case y:
code;
break;
}
Breaks from
Used for creating name or an alias for a type (particularly used for aliases and for nominating structs)
Declares a union; a structure containing one object that can interpret a datarange as the types specified in the union
Executes code on true condition if the last if statement was false
Constructor of a class (method to initialise instaces of a class)
class() {
code
}
Deconstructor of a class (method to destroy instance of class)
~class() {
code
}
Dynamic array
Linked list
Hash table with key values
Hash table with key value and data value pairs
Input and output control
Character out; object representing output stream
std::cout << "Hello world";
End line; flushes the iostream buffer to the terminal and indents a new line
Character in; object representing input stream
std::cin >> "Hello world";
Special type for sequence container sizes
std::cin >> "Hello world";
Memory Allocation; Allocates block of RAM in heap for an object
Continuous Allocation; Allocates blocks of RAM for a variable contiguously, setting the variables space to all 0s
(type *) calloc(nitems, size);
Deallocates RAM for a variable
free(*p);
String
Integer
Float
Float with 1 decimal place, the 1 can be modified to imply more decimal places
Integer in hexadecimal (lowercase a b c d e f)
Integer in hexadecimal (uppercase A B C D E F)
New line
Horizontal tab
Vertical tab
Question mark
Single quote
Double quote
Backslash
Backspace
Includes foreign file's methods
Defines a constant
Defines a lambda expression
#define max(A, B) ((A) > (B) ? (A) : (B))
Used to tell compiler the rest of this line is not to be compiled
Opens a multi line comment
Closes a multi line comment