C语言基础补习

时间:2021-11-08 21:10:53

coolshell 中一个小例子在VC6.0编译后反汇编结果仅作记录:

源码:

#include <stdio.h>
int main(void)
{
int a[];
printf("%x\n", a);
printf("%x\n", a+);
printf("%x\n", &a);
printf("%x\n", &a+);
}

VC6.0编译后的汇编代码:

:       int a[];
: printf("%x\n",a);
8D EC lea eax,[ebp-14h]
0040103B push eax
0040103C 1C push offset string "%x\n" (0042201c)
E8 BA call printf ()
C4 add esp,
: printf("%x\n",a+);
8D 4D F0 lea ecx,[ebp-10h]
0040104C push ecx
0040104D 1C push offset string "%x\n" (0042201c)
E8 A9 call printf ()
C4 add esp,
: printf("%x\n",&a);
0040105A 8D EC lea edx,[ebp-14h]
0040105D push edx
0040105E 1C push offset string "%x\n" (0042201c)
E8 call printf ()
C4 add esp,
: printf("%x\n",&a+);
0040106B 8D lea eax,[ebp]
0040106E push eax
0040106F 1C push offset string "%x\n" (0042201c)
E8 call printf ()
C4 add esp,
: return ;