2015年5月19日

位域的概念

摘要: 1 #include 2 #include 3 4 struct MyStruct 5 { 6 //位域,限定数据的位数,节约内存 7 unsigned int a : 5; 8 unsigned int b : 5; 9 unsigned in... 阅读全文

posted @ 2015-05-19 10:10 Dragon-wuxl 阅读(2873) 评论(0) 推荐(0)

2015年5月18日

结构体与指针

摘要: 1 #include 2 #include 3 #include 4 5 struct data 6 { 7 int num; 8 }; 9 void main()10 {11 struct data(*p)[10] = malloc(sizeof(struct data) * ... 阅读全文

posted @ 2015-05-18 22:24 Dragon-wuxl 阅读(126) 评论(0) 推荐(0)

结构体和结构体副本机制

摘要: 1 #include 2 #include 3 4 struct MyStruct 5 { 6 int a[10]; 7 int length; 8 }; 9 10 void change(struct MyStruct s1)//副本机制,对于结构体生效(结... 阅读全文

posted @ 2015-05-18 21:28 Dragon-wuxl 阅读(311) 评论(0) 推荐(0)

结构体大小

摘要: 1 #include 2 #include 3 4 /* 5 6 结构体大小大于等于所有成员的大小之和 7 char int double float //基本类型 double最宽基本成员 8 结构体的大小必须可以整除最宽基本成员 9 结构体成员的地址... 阅读全文

posted @ 2015-05-18 13:10 Dragon-wuxl 阅读(128) 评论(0) 推荐(0)

结构体动态数组,结构体与指针

摘要: 1 #define _CRT_SECURE_NO_WARNINGS 2 #include 3 #include 4 #include 5 #include 6 7 8 struct csdn 9 {10 int id;11 int num;12 };13 14 void mai... 阅读全文

posted @ 2015-05-18 10:15 Dragon-wuxl 阅读(417) 评论(0) 推荐(0)

2015年5月17日

结构体数组

摘要: 1 #include 2 #include 3 4 // 结构体数组的定义 5 6 struct // 匿名结构体 主要作用是锁定变量的个数 7 { 8 int num; 9 double db;10 }*p,x[10],z; // p是指针 x是数组 z 是变量11 12... 阅读全文

posted @ 2015-05-17 22:31 Dragon-wuxl 阅读(189) 评论(0) 推荐(0)

结构体的嵌套

摘要: 1 #include 2 #include 3 4 //链表嵌套实现继承,描述复杂的事物属性,C数据结构都是结构体, 5 struct other 6 { 7 int canmove; 8 }; 9 10 struct animal11 {12 struct other o... 阅读全文

posted @ 2015-05-17 16:05 Dragon-wuxl 阅读(224) 评论(0) 推荐(0)

结构体的赋值

摘要: 1 #include 2 #include 3 4 struct MyStruct 5 { 6 int a[5]; 7 char str[10]; 8 char *p; 9 };10 11 void main()12 {13 // 数组 变量没有深浅拷贝的差别 ... 阅读全文

posted @ 2015-05-17 15:31 Dragon-wuxl 阅读(120) 评论(0) 推荐(0)

结构体,深浅拷贝

摘要: 1 #include 2 #include 3 4 struct MyStruct 5 { 6 char *p; 7 int num; 8 }; 9 10 //对于数据来说,深浅拷贝一样,对于指针,浅拷贝是拷贝地址,深拷贝拷贝内存内容11 void main()12 {13 ... 阅读全文

posted @ 2015-05-17 12:53 Dragon-wuxl 阅读(125) 评论(0) 推荐(0)

结构体的引用

摘要: 1 #include 2 #include 3 4 struct MyStructA 5 { 6 //int num = 10;// C语言结构体内部变量不能有初始化 C++ 可以 7 int num; 8 char str[10]; 9 };10 11 struct M... 阅读全文

posted @ 2015-05-17 10:36 Dragon-wuxl 阅读(163) 评论(0) 推荐(0)

导航