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 这次我主要阅读了这本书的第九十章,通过看这章的知识了解了不少的知识开发某系统的重要前提是:这个系统有谁在用?这些人通过这个系统能做什么事? 一般搞清楚这 ...
随机推荐
- elementui中的el-table,(prop对应多个属性)中拼接两个列表字段并展示
elementui中的el-table,(prop对应多个属性)中拼接两个列表字段并展示 <el-table-column prop="pa_dt_name,pa_duty_name& ...
- vue之关闭eslint及vue/require-v-for-key 、vue/no-unsed-vars报错解决方法
报错:Page1组件已经注册但是没有被使用. vue/no-unused-components 如果报错以下: 解决方法: 首先打开项目中的package,json 找到eslint-config ...
- ubuntu为navicat创建快捷方式
一.前言 最近在ubuntu上安装了navicat,但是发现不能将其固定在启动栏阿!!!不能每次都用terminal运行吧!于是在上网查,有一说一,网上很多文章写的方法都不能实现(不排除是ubuntu ...
- .Net使用第三方onnx或ModelBuilder轻松接入AI模型
ML.Net - 开源的跨平台机器学习框架 支持CPU/GPU训练 轻松简洁的预测代码 可扩展其他的机器学习平台 跨平台 1.使用Visual Studio的Model Builder训练和使用模型 ...
- Hugging News #0602: Transformers Agents 介绍、大语言模型排行榜发布!
每一周,我们的同事都会向社区的成员们发布一些关于 Hugging Face 相关的更新,包括我们的产品和平台更新.社区活动.学习资源和内容更新.开源库和模型更新等,我们将其称之为「Hugging Ne ...
- flutter dio自定义http client
final dio = Dio(); Dio getMyDio() { initAdapter(); dio.options.headers = {'apiKey': 'xxxxx'}; dio.op ...
- 混沌演练状态下,如何降低应用的 MTTR(平均恢复时间)
在企业业务领域,锦礼是针对福利.营销.激励等员工采购场景的一站式解决方案,包含面向员工.会员等弹性激励SAAS平台.由于其直接面向公司全体员工,其服务的高可用尤其重要,本文将介绍锦礼商城大促前夕,通过 ...
- GO 集合 map 使用总结
转载请注明出处: Go语言的集合称为映射(map),它是一种无序的键值对(key-value)的集合,集合是通过键(key)来快速检索值(value)的,键(key)类似于索引,它指向值(value) ...
- MyBatis体系笔记
MyBatis 什么是MyBatis MyBatis是优秀的持久层框架 MyBatis使用XML将SQL与程序解耦,便于维护 MyBatis学习简单,执行高效,是JDBC的延伸 1.MyBatis开发 ...
- selenium元素定位---ElementNotInteractableException(元素不可交互异常)解决方法
方法一: 增加强制等待时间 方法二: 使用js点击 element = self.browser.find_element(By.XPATH, "//td[@class='el-table_ ...