c指针5

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;//编译通过,
px->a 取值为10,后面不知道是什么玩意,就是指向一个地址,安定义的字节取值哈哈。运气好能看到值,运气不好005错误,噫
//10 00 00 00 xxxxxxxxxx






  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值