EQuestionAnswers.com Computer/Electronics Questions and Answers
C, C++, VC++, COM/DCOM, DLL and more
#Login #Sign up  Facebook Twitter TGoogle+
 

In C and C++, the calling convention is backwards, i.e. the variable declared last will be pushed into the stack first.

Whereas in PASCAL the calling convention is just the opposite of that of C and C++, i.e. the variable declared first is pushed into the stack first.

So in PASCAL, the variables are called in order whereas in C and C++ they are called in opposite order.
Following example shows the call stack of a function void funct(int i, int j) written in C/C++ and PASCAL.

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

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

Similar topics related to this section

# C/C++ Interview questions and answers - Shetty's World
# C Interview Questions and Answers - C Interview FAQs & C Books
# C interview questions and answers | TechInterviews
# C Interview Questions and Answers :: ALL Interview .com
# C Interview Questions and Answers

Feedback: Suggestion and feedback

* * * * * Rate this topic.

Help us to improve this topic. Your feedback is essential to us. Please suggest your remarks, ratings and corrections regarding the above section. Please fill the form and submit. If your suggestion contains graphics/formatted text/word document, please attach file(s).

Name:*
Email:*
Text Answer:*
Attach Doc:
 

Note: Only members are allowed, * fields are mandatory.