Programming abstractions in C阅读笔记:p123-p126
《Programming Abstractions In C》学习第50天,p123-p126,总结如下:
一、技术总结
1.notaion
这也是一个在计算机相关书籍中出现的词,但有时却不是那么好理解,因为它可以指代很多对象,这里做一个记录。示例:p124。
In C, you can use any character array to hold string data.
char str[6] = {'h', ' ', 'l', ' ', 'o', '\0'};
or, more compactly,
char str[6] = "hello";
If you use array notation, the standar idion for processing every character in a string looks like this:
for (int i = 0; str[i] != '\0'; i++) {
printf("i=%d\n", str1[i]);
}
在这里,“notation”以理解为“the activity of representing sth by a special system of marks or character”,即“notation”表示的是一种“标记方法”、“表示方法”。
2.字符串用法示例
#include <stdio.h>
// 统计字符串中的空格(space):数组版
static int CountSpaces(char str[]) {
int i, nSpaces;
nSpaces = 0;
for (i = 0; str[i] != '\0'; i++) {
if (str[i] == ' ') {
nSpaces++;
}
}
return nSpaces;
}
// 统计字符串中的空格(space):指针版
static int CountSpaces1(char *str) {
int nSpaces;
char *cp;
nSpaces = 0;
for (cp = str; *cp != '\0'; cp++) {
if (*cp == ' ') {
nSpaces++;
}
}
return nSpaces;
}
int main() {
// 方式一:declare and initialize a string "hello"
char str1[6] = {'h', ' ', 'l', ' ', 'o', '\0'};
// 遍历字符串
for (int i = 0; str1[i] != '\0'; i++) {
printf("i=%d\n", str1[i]);
}
// 方式二:更紧凑(compactly)
char str2[6] = "hello";
// 统计字符串中的空格
int n;
n = CountSpaces(str1);
printf("\nthe number of spaces in string is: %d\n", n); // 2
// 统计字符串中的空格
int n1;
n1 = CountSpaces1(str1);
printf("\nthe number of spaces in string is: %d\n", n1); // 2
}
二、英语总结
1.perfectively什么意思?
答:perfect是“完美的”之意,但是perfectly翻译的时候直接翻译成"完美地"却不大合适。应该翻译成"adv. perfectly can alse mean very or compeletly"(很,非常)更好,当然,其实这个意思也是“in a perfect way”。
2.likelihood什么意思?
答:u.the chance than sth will happen(可能性),同义词:possibility。
三、参考资料
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
欢迎搜索及关注:编程人(a_codists)
Programming abstractions in C阅读笔记:p123-p126的更多相关文章
- Mongodb Manual阅读笔记:CH3 数据模型(Data Models)
3数据模型(Data Models) Mongodb Manual阅读笔记:CH2 Mongodb CRUD 操作Mongodb Manual阅读笔记:CH3 数据模型(Data Models)Mon ...
- Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第二十三章:角色动画
原文:Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第二十三章:角色动画 学习目标 熟悉蒙皮动画的术语: 学习网格层级变换 ...
- Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第十一章:模板测试
原文:Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第十一章:模板测试 代码工程地址: https://github.co ...
- Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第六章:在Direct3D中绘制
原文:Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第六章:在Direct3D中绘制 代码工程地址: https://gi ...
- Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第四章:Direct 3D初始化
原文:Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第四章:Direct 3D初始化 学习目标 对Direct 3D编程在 ...
- Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第二章:矩阵代数
原文:Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第二章:矩阵代数 学习目标: 理解矩阵和与它相关的运算: 理解矩阵的乘 ...
- Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第一章:向量代数
原文:Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第一章:向量代数 学习目标: 学习如何使用几何学和数字描述 Vecto ...
- 阅读笔记 1 火球 UML大战需求分析
伴随着七天国庆的结束,紧张的学习生活也开始了,首先声明,阅读笔记随着我不断地阅读进度会慢慢更新,而不是一次性的写完,所以会重复的编辑.对于我选的这本 <火球 UML大战需求分析>,首先 ...
- [阅读笔记]Software optimization resources
http://www.agner.org/optimize/#manuals 阅读笔记Optimizing software in C++ 7. The efficiency of differe ...
- 《uml大战需求分析》阅读笔记05
<uml大战需求分析>阅读笔记05 这次我主要阅读了这本书的第九十章,通过看这章的知识了解了不少的知识开发某系统的重要前提是:这个系统有谁在用?这些人通过这个系统能做什么事? 一般搞清楚这 ...
随机推荐
- pupstudy的使用
打开环境 点击管理--打开根目录 把靶场放在www文件夹里 网页打开127.0.0.1/靶场文件名即可
- 聊聊ElasticeSearch并发写的乐观锁机制
概述 ES的多客户端并发更新是基于乐观并发控制,通过版本号机制来实现冲突检测. 关键对象 ES的老版本是用过_version字段的版本号实现乐观锁的.现在新版增加了基于_seq_no与_primary ...
- L1-025 正整数A+B (15 分)
1.题目描述: 题的目标很简单,就是求两个正整数A和B的和,其中A和B都在区间[1,1000].稍微有点麻烦的是,输入并不保证是两个正整数. 输入格式: 输入在一行给出A和B,其间以空格分开.问题是A ...
- 计算机网络OSI七层参考模型和tcp/udp五层参考模型
计算机网络OSI七层参考模型和tcp/udp五层参考模型 目录 一.OSI七层参考模型和TCP/UDP五层参考模型 1.应用层 2.表示层 3.会话层 4.传输层 5.网络层 6.数据链路层 7.物理 ...
- Kubernetes 证书详解
K8S 证书介绍 在 Kube-apiserver 中提供了很多认证方式,其中最常用的就是 TLS 认证,当然也有 BootstrapToken,BasicAuth 认证等,只要有一个认证通过,那么 ...
- elment UI + EasyExcel 实现 导入
前端组件 <hd-flex> <el-dialog v-model="isUploadDialog" width="50%" lock-scr ...
- 数据科学工具 Jupyter Notebook 教程(一)
ipython notebook 是一个基于浏览器的 python 数据分析工具,使用起来非常方便,具有极强的交互方式和富文本的展示效果.jupyter 是它的升级版,它的安装也非常方便,一般 Ana ...
- 新版本,ggplot2 v3.3.0 新特性来袭
ggplot2 迎来了新的版本,官方宣布了一些新的特性.下面一起看看吧. 1. 轴代码重写 这有利于解决轴标签重叠的情况. 2. 新的 scale bin,它可以像使用 color, fill 一样使 ...
- C++面试八股文:static_cast了解一下?
某日二师兄参加XXX科技公司的C++工程师开发岗位第20面: 面试官:C++中支持哪些类型转换? 二师兄:C++支持C风格的类型转换,并在C++11引入新的关键字规范了类型转换. 二师兄:C++11引 ...
- 8. 自定义映射resultMap
在 Mybatis 中,resultType 和 resultMap 都用于定义查询结果的映射关系.它们的使用场景如下: resultType resultType 用于指定返回结果的数据类型,通 ...