Programming abstractions in C阅读笔记:p84-p87

《Programming Abstractions In C》学习第43天,p84-p87总结。

一、技术总结

1.record

record也称为structure(结构体),是一种数据结构。record里面的成员称为record的field。对于record,需要其基本用法:定义、声明、field访问以及其与指针的关系。示例:

c 复制代码
// 定义structure type语法:
/*
typedef struct {
    field-declarations; // structure里面的成员称为field
} name; // structure的名字
*/

// 定义structure
typedef struct {
    char *name;
    char *title;
    char *ssnum;
    double salary;
    int withholding;
} employeeRecordT;



void main() {
    // 声明结构体变量
    employeeRecordT empRc;

    // record selection: empRc.name;

    // 初始化
    empRc.name = "Ebenezer Scrooge";
    empRc.title = "Partner";
    empRc.ssnum = "271-82-8183";
    empRc.salary = 250.00;
    empRc.withholding = 1;

    // 指针与record
     employeeRecordT *empPtr;
     empPtr = &empRc;

    // 指针如何访问record里面的field
    // 方式1:
    (*empPtr).name; // 注意.的优先级高于*
    // 方式2:因为方式1每次都要加括号比较麻烦,所以引入了->操作符
    empPtr->name;

}

二、英语总结

1.payroll是什么意思?

答:payroll: pay+ roll:total amount paid to employees over a period(工资名单,发放总额)。roll:常用作动词,但也有名词的用法:a piece of file, paper or cloth that is rolled into the shape of a tube(卷,卷轴)。

2.withholding status什么意思?

答:withhold:tv. to refuse to give back sth,隐瞒、扣留。示例:withhold information(隐瞒信息)

3.firm什么意思?

答:n. a small company(小公司)。

三、参考资料

1.编程

1)Eric S.Roberts,《Programming Abstractions in C》:https://book.douban.com/subject/2003414

2.英语

1)Etymology Dictionary:https://www.etymonline.com

2)Cambridage Dictionary:https://dictionary.cambridge.org

3)Merrian-Webster Dictionary:https://www.merriam-webster.com

4)Collins Dictionary:https://www.collinsdictionary.com

5)Oxford Dictionary:https://www.oxfordlearnersdictionaries.com

6)The Free Dictonary:https://www.thefreedictionary.com

7)Urban Dictionary:https://www.urbandictionary.com

欢迎搜索及关注:编程人(a_codists)

相关推荐
The_superstar63 天前
衡山派D133EBS入门笔记
笔记·python·c·衡山派·小曹越
charlie1145141913 天前
嵌入式Linux驱动开发(8)——内存映射 I/O - 别拿物理地址当指针用
linux·开发语言·驱动开发·c·imx6ull
邪修king3 天前
C++ 模板进阶超全攻略:非类型模板参数、模板特化、分离编译与避坑指南
开发语言·c++·c
charlie1145141914 天前
嵌入式Linux驱动开发(7) 从虚拟设备到真实硬件 —— LED驱动硬件基础
linux·开发语言·驱动开发·内核·c
charlie1145141916 天前
通用GUI编程技术——图形渲染实战(三十六)——Constant Buffer与数据传递:CPU-GPU通信通道
开发语言·c++·windows·c·图形渲染·win32
17岁boy想当攻城狮8 天前
GlibC 在线程里引发use-after-free退出时才崩溃原因与分析
c·glibc
少司府9 天前
C++基础入门:初识模板
开发语言·c++·c·模板·函数模板·类模板·泛型编程
REDcker9 天前
跨平台编译详解 工具链配置与工程化实践
linux·c++·windows·macos·c·跨平台·编译
小辉同志10 天前
Epoll+线程池
开发语言·c++·c·线程池·epoll
光电笑映12 天前
深入C++异常:栈展开、异常安全与工程规范
开发语言·c++·c