Stack information for function calls

Source: Internet
Author: User

/*
1, stack on the heap, the address of the stack is reduced, the heap address is increased.
2, the parameters of the method on the stack, the parameters are from right to left into the stack, why?
Mainly to solve the problem of variable parameters, from right to left into the stack, the top of the stack is the first parameter,
The first argument indicates the number of arguments, or the number of arguments (the formatted string for printf).
From the top of the stack, you can traverse these parameters.
3, PA itself is also allocated on the stack, PA address is smaller than a address, PA content is a address
4, the PPA itself is also allocated on the stack, the PPA address is smaller than the PA address, the content of the PPA is PA address
5, stack on the array tmp, equivalent to cut out 8 bytes on the stack, TMP points to the top of the stack, the address is the smallest, from the top of the stack to high address
There are 8 bytes, copy "abcdef" (7 bytes, including null) into these 8 bytes, a at the top of the stack, the least address
*/
void Test (int a, int b)
{
int* PA = &a;

int** PPA = &pa;

Char tmp[8] = "abcdef";
}

Stack information for function calls

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.