Difference between revisions of "C language"
(→const) |
(→const) |
||
Line 11: | Line 11: | ||
=== const === | === const === | ||
Read only. Can be applied to any declaration. | Read only. Can be applied to any declaration. | ||
+ | const volatile unsigned long int base_address = 0xFFFF; | ||
== Loop constructs == | == Loop constructs == |
Revision as of 00:17, 23 January 2011
Contents
Things to remember about the C language if you want to keep sane
Declarations
#define
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. Can be applied to any declaration.
extern
static
const
Read only. Can be applied to any declaration.
const volatile unsigned long int base_address = 0xFFFF;
Loop constructs
for() direction and signed while do while
switch(var) { case 0: //code break; }
if else
& | ^ ~ >> (signed or not?) <<
&& || ==
!= > < >= <=
+= -=
- =
/= >>= <<=
Type specifiers
Data types
- char
- long
- long long
- float
- double
- short
- int
Other
- void
- signed
- unsigned
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 "file" <file>
.c
.h
included libraries