int* arr=[5]={0};arr[0]=(int*)10;arr[1]=(int*)10;
arr[2]=(int*)10;
arr[3]=(int*)10;
arr[4]=(int*)10;
int a = 10; mov dword ptr[ebp-4],0Ah int b = 20; mov dword ptr[ebp-8],14h int c = 30; mov dword ptr[ebp-0Ch],1Eh int d = 40; mov dword ptr[ebp-10h],28h int e = 50; move dword ptr[ebp-14h],32h int* arr[5] ={&a,&b,&c,&d,&e} lea eax,[ebp-4] mov dword ptr[ebp-28h],eax lea ecx,[ebp-8] mov dword ptr[ebp-24h],ecx lea edx,[ebp-0Ch] mov dword ptr[ebp-20h],edx lea eax,[ebp-10h] mov dword ptr[ebp-1Ch],eax lea ecx,[ebp-14h]
struct Atr{ int a; int b; int c; }
mov dword ptr[ebp-18h],ecx
指针数组:结构体指针:char* keyword[]={"if","for","while","switch"}; mov dword ptr[ebp-10h],offset string "if"(常量区地址) mov dword ptr[ebp-1Ch],offset string "%s\n"(常量区地址) mov dword ptr[ebp-18h],offset string "while"(常量区地址) mov dword ptr[ebp-14h],offset string "china"(常量区地址)
struct Arg{ int a; int b; int c; } Arg* pArg; pArg=(Arg)100;
反汇编代码都差不多,为什么有这么多类型:运算不一样,方便编译器。
pArg =(Arg*)100;
pArg=pArg+5;
printf("%d\n",pArg);
//输出结果为160 100+3*4*5
pArg2 =(Arg*)20;
int x = pArg-pArg2;//同类型指针运算 结果为int类型。 汇编代码为 100-20/12 =6 idiv 50h,0ch;
Arg s;
s.a = 10;
mov dword ptr[ebp-0ch],0Ah
s.b = 20;
mov dword ptr[ebp-8],14h
s.c = 30;
mov dword ptr[ebp-4],1Eh
Arg* px = &s;
lea eax,[ebp-0ch]
mov dword ptr[ebp-10h],eax
px->a //->结构体指针操作->编译器看这个就是这个地址的a的值
printf("%d\n",px->a)
struct Arg{
int a;
charb;
short c;
}
px->a=100;
px->b=200;//char溢出越界-56
px->c=300;
int x =10;
Arg* px = (Arg*)&x;//编译通过,
//10 00 00 00 xxxxxxxxxxpx->a 取值为10,后面不知道是什么玩意,就是指向一个地址,安定义的字节取值哈哈。运气好能看到值,运气不好005错误,噫
c指针5
最新推荐文章于 2022-09-12 20:26:17 发布