C language review
1. Why header file
provides a centralized location to store the header file for the relevant statement. Declaration defines header file typically contains the class, and a function declaration variables extern
2. Common bit operation
& Bitwise AND
| Bitwise OR
^ bitwise exclusive OR
~ negated
<< shift left
>> right
3. # include instruction receiving two forms:
#include <standard_header>
#include "my_file. H "
4. dEFINE # key macro definition
#define identifier string
5. # ifdef, # ifndef conditional compilation
#ifndef SALESITEM_H
#define SALESITEM_H
// Definition of Sales_itemclass and Related Functions goes here Wallpaper
#endif
6. The variable # extern statement
represents when a variable or function is defined in another file, suggesting that the compiler encounters this variable and function not to find its definition in other modules. Extern can declare variables for many times, but only once defined
7. # typedef typedef
typedef used to define data types, i.e. int double char etc., exm: typedef (means define type ) typedef int a, int i.e. may be replaced as a data type, a number numbers; (means int number and int numbers)
8.enum Enumeration
enum enumeration, i.e. the definition of the variable as a constant within the braces. enum books {name = 1, money , where, test1, test = 3}; if missing, then the former is a member of a value of +1, where the order of 1,2,3,4,3
9.static keyword
its local variables stated, has a memory function
10.struct structure
struct {name structure
member list 1;
member list 2;
...
} the list of names;
when the structure declaration can be defined variable may be declared Once defined, is
struct structure name structure variables list;
11.MDK address register name mapping
peripheral base address for the peripheral base address whose address
AHB1 address 0x00020000 peripheral base address +
GPIOA_BASE AHB1 address 0x0000 +
with GPIOA GPIOA_BASE address + offset address
#define GPIOA ((GPIO_TypeDef *) GPIOA_BASE )
will be converted to force GPIO_BASE GPIO_TypeDef type structure pointer, points to the address with GPIOA GPIOA_BASE will transfer continuously after the address into the structure type