当前位置: 首页 > news >正文

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)

http://www.lryc.cn/news/133605.html

相关文章:

  • 自然语言处理从入门到应用——LangChain:链(Chains)-[通用功能:LLMChain、RouterChain和SequentialChain]
  • ElasticSearch-安装部署全过程
  • mathematica报错:Tag Plus is \ Protected
  • Python Django 模型概述与应用
  • Golang Gorm 更新字段 save update updates
  • springBoot 配置文件引入 redis 的相关参数说明
  • Docker的使用心得:简化开发与部署的利器
  • vue3 基于element plus对el-pagination进行二次封装
  • RuntimeError: result type Float can‘t be cast to the desired output type __int64报错解决方法
  • 解析Python爬虫常见异常及处理方法
  • 详解Spring的循环依赖问题、三级缓存解决方案源码分析
  • oracle分析函数学习
  • 代码随想录训练营day17|110.平衡二叉树 257. 二叉树的所有路径 404.左叶子之和 v...
  • C# Thread用法
  • 新榜 | CityWalk本地生活商业价值洞察报告
  • LVS负载均衡集群-NAT模式部署
  • C++学习笔记总结练习:effective 学习日志
  • Vue教程(五):样式绑定——class和style
  • 开放网关架构演进
  • torch一些操作
  • ICCV23 | Ada3D:利用动态推理挖掘3D感知任务中数据冗余性
  • 软件工程模型-架构师之路(四)
  • ubuntu20.04共享文件夹—— /mnt/hgfs里没有共享文件夹
  • Redis中的有序集合及其底层跳表
  • js 小程序限流函数 return闭包函数执行不了
  • 【数据结构】堆的初始化——如何初始化一个大根堆?
  • 【韩顺平 零基础30天学会Java】程序流程控制(2days)
  • 从入门到精通Python隧道代理的使用与优化
  • 19万字智慧城市总体规划与设计方案WORD
  • [赛博昆仑] 腾讯QQ_PC端,逻辑漏洞导致RCE漏洞