自己定义一个结构体,使用struct关键字struct student{ char
name[20]; int age; int
num;};定义好结构体,student就相当于变量类型,我们可以直接用来定义一个student类型的变量:student
A;也可以直接在定义结构体的时候直接进行...
分类:
编程语言 时间:
2014-05-20 01:08:22
阅读次数:
266
#include using namespace std;#define
StructArrarySize 5 // 老师数量 #define StudentNum 3 // 每位老师...
分类:
其他好文 时间:
2014-05-20 00:11:27
阅读次数:
342
/* 题目: //声明一个结构体类型 struct _AdvTeacher { char
*name; char *tile; int age; ...
分类:
其他好文 时间:
2014-05-19 23:56:31
阅读次数:
412
linux中的经典宏定义 offsetof
定义:offsetof在linux内核的include/linux/stddef.h中定义。 #define offsetof(TYPE, MEMBER)
((size_t) &((TYPE *)0)->MEMBER)说明:获得结构体(TYPE)的变量成员...
分类:
系统相关 时间:
2014-05-18 01:30:21
阅读次数:
515
Felling By Ruiy:Pre-learnning link list knowloages
熟悉
指针相关操作应用+结构体数据类型应用,且能简单融合使用,堆内存(内存泄露)->类似于你使用完在食堂吃饭的饭盒,吃完饭后你把那个餐具饭盒给带走了,没还给食堂,使此饭盒没能再次被别的人使用.哎,....
分类:
其他好文 时间:
2014-05-17 21:31:32
阅读次数:
307
1.结构体1>.NSRange(location, length);
从location这个位置开始计数长度为lengthNSRange的创建方式:NSRange r1 = {location, length}; // es:
NSRange r1 = {2, 4}; 一般不这样写NSRange r...
分类:
其他好文 时间:
2014-05-15 09:50:55
阅读次数:
246
//***************************************************************
//结构体:简单的静态链表
#include
#include
#define NULL 0
#define SIZE 10
struct student
{
char num[SIZE];
float score;
struct student *next;
...
分类:
编程语言 时间:
2014-05-15 02:55:09
阅读次数:
359
做一件事情首先应该知道它的目的是什么。
container_of的目的:如何通过结构中的某个变量获取结构本身的指针。
总体思路:假想一下,你的结构体中有好几个成员,你如何通过里面的“任一成员”获取
整个结构体的首地址呢。container_of的做法就是通过typeof定义一个与“任一成员”同类型
的指针变量pvar_a(假设变量名就是pvar_a),并让指针变量pvar_a指向这个“...
分类:
系统相关 时间:
2014-05-14 19:56:15
阅读次数:
494
//通过结构体/类的类型来作为模板参数的tag,
//用来区分tag之间的区别。
//made by davidsu33
//例如对于某个全局的静态变量,你如果希望有
//很多份,但是其实现又是一样的,你可以考虑
//以模板的形式,通过类tag来区分
//而且还可以根据实际需要来特化模板
#include "stdafx.h"
#include
#include
using nam...
分类:
其他好文 时间:
2014-05-14 19:33:42
阅读次数:
234