Integer
64
64
64
64
Floating point decimal
64.0
Double precision floating point decimal
64.0
Character
"a"
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
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
Defines a block
Initialises an array
int numbers[] = {0, 1, 2, 3};
Used for switch cases
Used for separating true and false returns in conditional expressions
retval = exp ? trueret : falseret
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
Typecasting; enforcing a type
Unary memory address of a variable
&x
Denotes imported module file
#include <stdio.h>
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 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
Prints a message
printf(char *);
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