C stack address is from the high address constantly forget the low address expansion, the first function called the highest stack address, after the address is called Low:
A-"h" These addresses indicate a basic invocation relationship, AB is a function entry, and a CD is a variable within a function.
The caller precedes the high address, and the caller is at the low address.
The order of the parameters is, at the left of the argument in the low address, the right side of the parameter in the high address, so if the entry is the function of the return value form, then the call order should be first and left.
The declaration of a variable in a function is a high-level address declared first, followed by the argument at the low address.
Today to see colleagues sent a crash problem location when you feel like Forget, review, hereby record ~
The function code is as follows:
#include <iostream>using namespacestd;#definePrint_addr (a) {cout << #a << ":" << (unsigned int) &a << ";" << "Val:" << a << ; Endl }voidSTACKFOUNCTINB (unsignedintUnparame, unsignedintUNPARAMF) {unsignedintUNPARAMG =7; unsignedintUNPARAMH =8; PRINT_ADDR (Unparame); PRINT_ADDR (UNPARAMF); PRINT_ADDR (UNPARAMG); PRINT_ADDR (UNPARAMH);}voidStackfounctina (unsignedintUnparama, unsignedintunparamb) {unsignedintUNPARAMC =3; unsignedintUNPARAMD =4; PRINT_ADDR (Unparama); PRINT_ADDR (UNPARAMB); PRINT_ADDR (UNPARAMC); PRINT_ADDR (UNPARAMD); STACKFOUNCTINB (5,6 );}intMain () {unsignedintUnparammaina =Ten; unsignedintUNPARAMMAINB = One; PRINT_ADDR (Unparammaina); PRINT_ADDR (UNPARAMMAINB); Stackfounctina (1,2 ); return 0;}
C Call Stack Relive