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)

相关推荐
haliu2 小时前
【FHE 同态加密】我们如何实现同态加密推理(十四):为什么 `RESULT=PASS` 不是判据(纯 C11 · 零依赖)
人工智能·嵌入式·c·fhe·推理引擎·c11·边缘推理·同态加密推理
haliu1 天前
【FHE】(十三):位级可复现性——4 线程与 8 线程为什么算出不同的结果
人工智能·嵌入式·c·fhe·推理引擎·c11·边缘推理·同态加密推理
haliu2 天前
【FHE】(十二):为什么我们把 OpenMP 换成了自研线程池
人工智能·嵌入式·c·fhe·推理引擎·c11·边缘推理·同态加密推理
haliu2 天前
【FHE】(十):密文里的 attention——没有 max,softmax 怎么办
人工智能·嵌入式·c·fhe·推理引擎·c11·边缘推理·同态加密推理
西西弗Sisyphus10 天前
Qt 实现一个 水波进度球
c++·qt·c
C++ 老炮儿的技术栈12 天前
我们在设计tcp协议时,要传一个字符串过去,报文:头十长度十内容,是否要把‘\0‘也填入,长度是否包含‘\0‘
开发语言·数据结构·c++·mfc·c
anew___12 天前
舵机——让 Arduino 动起来
c++·stm32·单片机·嵌入式硬件·c
光泽雨13 天前
IEnumerable<T> 详细讲解
c#·c
GG-_-Bond15 天前
9.1 kv存储内存池模拟面试问题
c++·c
anew___16 天前
蜂鸣器播放音乐——让 Arduino 唱出旋律
c++·stm32·单片机·嵌入式硬件·c