The runtime stack

When passing arguments to a function or when returning values from a function, you are using the runtime stack. When you call a function, parameters are pushed on the stack; before the function code executes, parameters are popped from the stack in the local variables defined in the function. When a function returns values, data is pushed on the stack and popped into variables specified in the RETURNING clause of the caller.

Elements are pushed on the stack in a given order, then popped from the stack in the reverse order. This is transparent to the programmer. However, if you want to implement a C extension, you must keep this in mind.

According to the data type, parameters are passed by value or by reference.