易截截图软件、单文件、免安装、纯绿色、仅160KB

keil c union 存储的问题

     3: int main()
     4: {
     5:    int i = 1,j;
     6:    union test{
     7:       int m;
     8:           char str[2];
     9:    }test;
    10:    test.m = 3;
    11:    //printf("the size of int is %d",sizeof(i));
C:0x0003    750A00   MOV      0x0A,#0x00
C:0x0006    750B03   MOV      0x0B,#0x03
这是在反汇编中的一段,意在查看union中变量的存储位置
查看a【0】=0x00;
     a【1】= 0x03;
编译中,为什么高位放在a【0】中,地位放在a【1】中?
跟字节对齐有关系吗?


相关文档:

C,C++网络编程学习简明

C,C++网络编程学习简明指南
1. 扎实的C,C++基础知识
参考资料《C程序设计》,《C++ primer》。
2. TCP/IP协议
经典书是:W.Richard Stevens 著《TCP/IP详解》三卷书,卷1是协议,卷2是实现,卷3是TCP事务协议等。还有官方的协议文档:RFC
当然也可以在网上下载电子书。
经典的开源协议分析工具:Wireshark. ......

《win32汇编》时钟之C代码

#include <Windows.h>
#include <math.h>
#include "resource.h"
#define PI 3.1415976/180
int dwCenterX,dwCenterY,dwRadius;
const TCHAR *szAppName=TEXT("Clock");
LRESULT CALLBACK ProcWinMain(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
void ShowTime(HWND hwnd,HDC hdc);
void ......

C/C++学习应该注意的几个细节


给我们上ASP.NET的老师在讲解C#的时候,总是要询问我们C#和C/C++间的不同之处,或者一些细节问题,但是平时不怎么注意,还真把我们给问到了!!
一.不经过中间变量怎样交换两个数据 int a=25;b=10;
解法: a=a+b;//35
        b=a-b;//25
      ......

C/C++也可以写的很安全!

今天看到一种比较安全的枚举写法!
enum example
{
item1 = 0,
item2,
item3,
item4,
item5,
max      /* when you want to add element,please add before this */
};
        当你使用它的时候:
example ex1;
        i ......

UVa Online Judge Volume C 题目和解答索引

UVa Online Judge - Volume C 题目和解答索引。前面为原题链接,后面为我的解答链接。
返回总目录
10003 - Cutting Sticks
Dynamic Programming
Solution
10004 - Bicoloring
Graph: BFS
Solution
10006 - Carmichael Numbers
Number Theory: Modulus
Solution
10010 - Where's Waldorf?
String
Solution ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号