[{"createTime":1735734952000,"id":1,"img":"hwy_ms_500_252.jpeg","link":"https://activity.huaweicloud.com/cps.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=V1g3MDY4NTY=&utm_medium=cps&utm_campaign=201905","name":"华为云秒杀","status":9,"txt":"华为云38元秒杀","type":1,"updateTime":1735747411000,"userId":3},{"createTime":1736173885000,"id":2,"img":"txy_480_300.png","link":"https://cloud.tencent.com/act/cps/redirect?redirect=1077&cps_key=edb15096bfff75effaaa8c8bb66138bd&from=console","name":"腾讯云秒杀","status":9,"txt":"腾讯云限量秒杀","type":1,"updateTime":1736173885000,"userId":3},{"createTime":1736177492000,"id":3,"img":"aly_251_140.png","link":"https://www.aliyun.com/minisite/goods?userCode=pwp8kmv3","memo":"","name":"阿里云","status":9,"txt":"阿里云2折起","type":1,"updateTime":1736177492000,"userId":3},{"createTime":1735660800000,"id":4,"img":"vultr_560_300.png","link":"https://www.vultr.com/?ref=9603742-8H","name":"Vultr","status":9,"txt":"Vultr送$100","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":5,"img":"jdy_663_320.jpg","link":"https://3.cn/2ay1-e5t","name":"京东云","status":9,"txt":"京东云特惠专区","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":6,"img":"new_ads.png","link":"https://www.iodraw.com/ads","name":"发布广告","status":9,"txt":"发布广告","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":7,"img":"yun_910_50.png","link":"https://activity.huaweicloud.com/discount_area_v5/index.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=aXhpYW95YW5nOA===&utm_medium=cps&utm_campaign=201905","name":"底部","status":9,"txt":"高性能云服务器2折起","type":2,"updateTime":1735660800000,"userId":3}]
<>C语言基础知识
C是编译型语言,《C Primer Plus》一书中介绍了编写C程序的7个步骤:
1.定义程序的目标
2.设计程序
3.编写代码
4.编译
5.运行程序
6.测试和调试程序
7.维护和修改程序
此外,C语言编程的基本策略是:将源代码文件转换为可执行文件(其中包含可直接运行的机器语言代码)。
典型的C实现是通过编译和链接两个步骤来完成的:
编译器:把源代码转化成中间代码
链接器:把中间代码和其他代码合并,生成可执行文件
假设一示例程序concrete.c:
// concrete.c #include<stdio.h> int main() { printf("Hello World !\n"); return
0; }
其从concrete.c到concrete.exe的流程图如下:
其中包含了编译和链接等步骤:
<>编译
源代码(.c文件)通过编译器转换为机器语言代码,并把结果放在目标代码文件(.obj文件)
在编译之前还有预编译:
* 处理“#”开头的关键字,如将#include包含的头文件引入到.c文件中,将#define的宏定义进行替换
* 删除注释
(1)将所有的#define删除,并且展开所有的宏定义。说白了就是字符替换
(2)处理所有的条件编译指令,#ifdef #ifndef #endif等,就是带#的那些
(3)处理#include,将#include指向的文件插入到该行处
(4)删除所有注释
(5)添加行号和文件标示,这样的在调试和编译出错的时候才知道是是哪个文件的哪一行
(6)保留#pragma编译器指令,因为编译器需要使用它们。
在编译之后,将源代码转换成汇编代码,然后通过汇编,将汇编代码转换成机器语言代码
2,目标代码缺失启动代码(startup
code)。启动代码充当着程序和操作系统直接的接口。在不同的操作系统下,目标代码相同,但系统启动代码不同,因为系统处理程序的方式不同。
3,目标代码还缺少库函数。几乎所有的C程序都要使用C标准库中的函数。
4,链接器的作用就是:把编写的目标代码、系统的标准启动代码和库代码这三部分合并成一个文件,即可执行文件。对于库代码,链接器只会把要用到的库函数代码提取出来。