In C and C++, the calling convention is backwards, i.e. the variable declared last will be pushed into the stack first.
Following example shows the call stack of a function void funct(int i, int j) written in C/C++.

Compiler disassembly

push 30
push 20
call _funct

Address Stack frame Value
0xA0008 j 30
0xA0004 i 20
0xA0000 return address of funct() code address of next to call

You have viewed 1 page out of 248. Your C learning is 0.00% complete. Login to check your learning progress.

 Vote 0

Similar topics related to this section

size of a structure, bit fields, l-value, struct and array, function declaration and definition, calling conventions, calling convention of C,C++ and PASCAL, library function linking, call-by-value and call-by-reference, parameter passing call-by-value,

# C Programming Language (Prentice Hall Software)
# Let Us C Paperback - 2006 by Yashavant Kanetkar
# Understanding and Using C Pointers Core techniques for memory management
# Data Structures Using C and C++ Paperback - 1998
# Data Structures In C Paperback - August 11, 2008 by Noel Kalicharan