C language

From ScienceZero
Revision as of 23:34, 22 January 2011 by Bjoern (Talk | contribs)

Jump to: navigation, search

Things to remember about the C language if you want to keep sane

Declarations =

volatile

The volatile keyword tells the compiler that the dollowing object is subject to sudden change in a way that is not described in the source code. For example a RS-232 data register that receive data from the outside. Volatile forces the compiler to generate the code that access the memory location each time instead of cache it in a register.


static

const

Loop constructs

for() direction and signed while do while


switch(var)
{
	case 0:
	//code
	break;
}

if else

& | ^ ~ >> <<

&& ||

== != > < >= <=

+= -=

  • =

/= >>= <<=


data types type casting subroutines void return global vs local


pointers

& (unsigned int *)

arrays multiple dimensions array pointers, 1d, 2d string, terminating character /n /r /t escape characters vs ""

character and on what type of lines is belongs on


include files .c .h included libraries