struct结构赋值

  1. int i=0;
  2. int j;
  3. j = i;
这是可以理解的

  1. typedef struct stu
  2. {
  3.     char name[10];
  4.     char sno[10];
  5.     int score;
  6. }stu;
  7. stu a;
  8. strcpy(a.name, "gnuser");
  9. strcpy(a.sno, "0000001");
  10. a.score=59; // f***k
  11. stu b;
  12. b = a;
现在b的内容也完全和a相同了。
反汇编一看,

  1. 0x08048762 <main+220>: mov   -0x30(%ebp),%eax
  2. 0x08048765 <main+223>: mov   %eax,-0x58(%ebp)
  3. 0x08048768 <main+226>: mov   -0x2c(%ebp),%eax
  4. 0x0804876b <main+229>: mov   %eax,-0x54(%ebp)
  5. 0x0804876e <main+232>: mov   -0x28(%ebp),%eax
  6. 0x08048771 <main+235>: mov   %eax,-0x50(%ebp)
  7. 0x08048774 <main+238>: mov   -0x24(%ebp),%eax
  8. 0x08048777 <main+241>: mov   %eax,-0x4c(%ebp)
  9. 0x0804877a <main+244>: mov   -0x20(%ebp),%eax
  10. 0x0804877d <main+247>: mov   %eax,-0x48(%ebp)
  11. 0x08048780 <main+250>: mov   -0x1c(%ebp),%eax
  12. 0x08048783 <main+253>: mov   %eax,-0x44(%ebp)
  13. 0x08048786 <main+256>: mov   -0x18(%ebp),%eax
  14. 0x08048789 <main+259>: mov   %eax,-0x40(%ebp)
  15. 0x0804878c <main+262>: mov   -0x14(%ebp),%eax
  16. 0x0804878f <main+265>: mov   %eax,-0x3c(%ebp)
  17. 0x08048792 <main+268>: mov   -0x10(%ebp),%eax
  18. 0x08048795 <main+271>: mov   %eax,-0x38(%ebp)
  19. 0x08048798 <main+274>: mov   -0xc(%ebp),%eax
  20. 0x0804879b <main+277>: mov   %eax,-0x34(%ebp)
依次拷贝。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值