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 这次我主要阅读了这本书的第九十章,通过看这章的知识了解了不少的知识开发某系统的重要前提是:这个系统有谁在用?这些人通过这个系统能做什么事? 一般搞清楚这 ...
随机推荐
- 2021-06-25:只由小写字母(a~z)组成的一批字符串,都放在字符类型的数组String[] arr中,如果其中某两个字符串所含有的字符种类完全一样,就将两个字符串算作一类,比如:baacbba
2021-06-25:只由小写字母(a~z)组成的一批字符串,都放在字符类型的数组String[] arr中,如果其中某两个字符串所含有的字符种类完全一样,就将两个字符串算作一类,比如:baacbba ...
- ChatGPT 打字机效果原理
一.背景 在初次使用 ChatGPT 时,我就被打字机的视觉效果吸引.总是感觉似曾相识,因为经常在一些科幻电影中看到,高级文明回传的信息在通讯设备的屏幕上以打字机效果逐步出现,在紧张的氛围下,输出人类 ...
- 一些JS过滤方法
一般过滤器我们都会卸载过滤filter文件内 本文这里就直接写正常methods格式的 //过滤空格 filterSpaces(data) { return data.replace(/\s+/g, ...
- MMCM and PLL Dynamic Reconfiguration
Reconfiguration is performed through the DRP. The DRP provides access to the configuration bits that ...
- Create Vite App 支持 OpenTiny 啦🎉
大家好,我是 Kagol,个人公众号:前端开源星球. 一个月前,日日自新写了一篇介绍 Create Vite App 开源项目的文章: 基于vite 4.x 快速搭建开箱即用,高度可定制化模版脚手架 ...
- UCOS II 源码分析一
再进行ucos操作系统源码分析前,先对ucos源码文件结构说个简单说明,只有掌握了源码文件结构才能在接下来的源码分析中逐渐感受到会当凌绝顶, 一览众山小,最后的感受就是RTOS也不是很神秘!下面以正点 ...
- es笔记五之term-level的查询操作
本文首发于公众号:Hunter后端 原文链接:es笔记五之term-level的查询操作 官方文档上写的是 term-level queries,表义为基于准确值的对文档的查询,可以理解为对 keyw ...
- 案例分享-被*队友的mybatis蠢哭的一天
昨晚加班的时候被队友拉着看一个mybatis的问题,耗费了我一个小时时间,最后差点没被我打死,实在是觉得滑稽,今天回家写下来跟大伙分享一下. 问题现象 Invalid bound statement ...
- js递归生成树形结构
先看结果 结果 [ { "id": 1, "title": "张三", "parent_id": -1, "c ...
- 【后端面经-Java】Java创建线程的方法简介
目录 1. 线程的基本概念 1.1 线程 1.2 线程状态和生命周期 2. 创建线程的四种方法 2.1 继承Thread类 2.2 实现Runnable接口 2.3 实现Callable接口 2.4 ...