Arithmetic Operators

see arithmeticoperators.c

Operation

Symbol

+

Add

-

Subtract

*

Multiply

/

Divide

%

Modulus

&

bitwise AND

|

bitwise OR

^

Bitwise XOR

~

Bitwise NOT



Language keywords

Keyword

Meaning

break

Exits a case in switch statement (here) or exits a loop (here)

case

Used to insert a clause into a switch statement block

char

(signed) 8 bit data type commonly used to hold ASCII values

const

Makes variable value or pointer parameter unmodifiable

continue

Similar to break but causes a jump to the test condition of the enclosing loop

default

At the end of switch statement, a default clause can be inserted using this keyword

do

Start of a do/while loop

double

The double precision floating point data type (8 bytes long usually)

else

Used in conjunction with the if statement to test values

enum

Can be used to autogenerate a sequence of constant values

extern

If you have multiple source files in a project, you may declare global variables (or functions) in one that are required in another. In such cases, declare the variables just once in one of the files and in other files use the same declaration but prefix it with extern.

float

The single precision floating point data type (4 bytes long usually)

for

Start of a for loop

goto

Jump to a particular label in the code.

if

Compare a value to another or check some condition

int

The integer data type (at least 2 bytes long)

long

The long integer data type – commonly 4 bytes long

register

Prefix this to a variable declaration to ask the compiler to try and keep this variable in a register (faster than memory)

return

Return from a function; optionally may include a return value

short

The short integer data type – usually 2 bytes long

sizeof

Returns the size (in bytes) of some data type or variable

static

Local variables declared using this as a prefix persist outside the scope within which they are declared. Static global variables are only accessible within the file they are declared (A bit like C++ private member variables)

struct

Define a structure (composite) date type

switch

The beginning of a switch block – essentially a multiple “if” statement

typedef

Define your own data type

union

Allows you to declare two variables that occupy the same space in memory

unsigned

Prefix this to an integer declaration to make it an unsigned number

void

The empty data type – commonly used to indicate that a function returns nothing.

volatile

Prefix to a variable to prevent the compiler from using stale copies of it.

while

The beginning of a while loop