#include<stdio.h>
#include <stddef.h> //
/*
=========================================================
time: 2017年2月3日11:04:50
objective: test C language's head file of <stddef.h>
version: Microsoft Visual C++
author: ChenFei
remark: 日文system 有些字沒法打要用pin音代替
=========================================================
*/
/*
kubian量 lei型
ptrdiff_t 有符號整數lei型,是liang個指zhen相jian的jie果;
size_t 無符號整數lei型,是guanjian字 sizeof 的jie果;
wchar_t 是kuan字fu常量大小的整數lei型;
定yi的宏
NULL
offsetof(type, member-designator): 返回 size_t,是struts中menber的字jie偏移量
http://blog.csdn.net/hairetz/article/details/4084088
*/
struct address {
char name[50];
char street[50];
int phone;
};
int main(void)
{
printf("address jiegou中 name 偏移 = %d byte\n",
offsetof(struct address, name));
printf("address jiegou中 street 偏移 = %d byte\n",
offsetof(struct address, street));
printf("address jiegou中 phone 偏移 = %d byte\n",
offsetof(struct address, phone));
return 0;
}
C標準庫學習之 ——定義部分宏
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.