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)

导航