Function Parameters and Stack
Learn about function parameters and stack structure.
We'll cover the following...
Function parameters example
This lesson discusses how a caller function passes its parameters via registers and how a callee (the called function) accesses them.
Here is the source code for the example:
Press + to interact
// FunctionParameters.cppint arithmetic (int a, int b);int main(int argc, char* argv[]){int result = arithmetic (1, 1);return 0;}// Arithmetic.cppint arithmetic (int a, int b){b = b + a;++a;b = b * a;return b;}
Stack structure
The registers, x0
–x29
, are used to address stack memory locations. Here, we provide a typical example of the stack memory layout for the following function where the x29
register is used: ...
Access this course and 1400+ top-rated courses and projects.