printf function of the stack sequence is from right to left pressure stack, the calculation of the expression value of the order is also from right to left, due to the variety of input data types, pressure stack when the data or data address MOV to register, and then the register pressure stack example:
#include <iostream>
using namespace std;
int main () {
int arr[] = {6, 7, 8, 9,};
int *ptr = arr;
* (ptr++) + = 123;
printf ("%d,%d\n", *ptr, * (++ptr));
printf ("%d,%d,%d,%d,%d\n", *ptr--, *ptr+20, * (ptr--), *ptr, * (++ptr));
int i = 5;
char ch = ' t ';
Char str[10] = "Test";
printf ("%s%c%d\n", str, CH, i);
printf ("%d%d%d%d\n", I, I., I, i--);
System ("pause");
return 0;
}
The output of the program in VS2013 is as follows:
Analysis:
Description
The real start of the pressure stack operation is from the Mov esi,esp start.
EAX is the addition register
MOV Eax,dword ptr[ptr] is an indirect addressing of the source operand.
The 360 questions are as follows:
int a[] = {3, 4}, b[] = {5, 6};
struct st{
int num;
int *p;
} S[2] = {100,a,100,b},*q = s;
int main () {
int n;
printf ("%d%d%d", *q->p,++q->num, (q++)->num);
return 0;
}
Output: 5101100