1. Typdef usage is shown below
1 Char uint8_t; 2 Short int uint16_t; 3 int uint32_t; 4 uint8_t i; // To define a 8-bit unsigned character type variable
2. Pointer function form
1 //defines a function pointer Pfun, pointing to a function with a return type of int, with a parameter of int2 int(*pfun) (int) ; 3 //The pointer level understands that the function's function name is a pointer4 //The pointer points to the first address of the function in memory5 intShiftfun (inta)6 {7 inttemp;8temp =A;9temp<<A;Ten returnA; One } A intMain () - { - inttemp; the //assigns the address of the function Shiftfun to the variable pfun -Pfun =Shiftfun; - //*pfun "is obviously taking the content of the address pointed to by Pfun, of course, is to take out the contents of function Shiftfun (), and then given a parameter of 2. -temp = (*pfun) (2); +}
3. typedef return TYPE (* new type) (parameter table)
1 typedef char (*ptrfun) (int ); 2 ptrfun pfun; 3 char glfun ( int a) {return ;} 4 void main () 5 { 6 pfun = Glfun; 7 (*pfun) (2 ); 8 }
Up to typedef void (*fun) (void);
The function of a typedef is to define a new type of known type, so the return value of the new type (*FUNC) (void) is void.
Defines a new type, which is a function pointer that points to a function parameter of void and the return value is void.
stm32bootload--typedef void (*fun) (void) Understanding