In the design of the program, will involve the use of the stack, in fact, stack refers to the heap and stack, they are two different concepts, where the heap is through the user to call the memory space, users need to actively allocate and release, if only allocated and not even if released, then there may be a memory leak problem, the results of incalculable The stack is the memory space that the system automatically calls, and the system will automatically release the space according to the actual situation.
In peacetime usage, we need to pay attention to the growth direction of the stack (here only refers to the stack), in general, when the stack pointer (stack top) from high address to low address growth, we call the downward growth, when the stack pointer (stack top) from the low address to high address growth, we call upward growth.
In the program design we also need to pay attention to the way data is stored---big-endian storage/small-end storage.
Big-endian storage---High-bit bytes of data are kept in low-memory addresses, while the low-level bytes of data are kept in the higher address of memory------(I am wayward)
Small-end Storage---High-level bytes of data are stored in the memory of the higher address, and the low byte of data is kept in the memory of the lower address
Size End test Method:
1.
// return 0:big_endian // return 1:little_endian Char Checkendian (void) { int1; If(* (char *) & number) return1; Else return0;}
2.
/**/**/int Checkendian () {int Char b;} C; 1 ; return 1 );}
3.
// return 0:big_endian // return 1:little_endian int Checkendian (void int a = 0x12345678 char *p= (unsigned char * ) &A; if (0x78 ==* p) return 1 else Return0;}
Stack direction and size end storage