> For the complete documentation index, see [llms.txt](https://labspc.gitbook.io/cnippets/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://labspc.gitbook.io/cnippets/chap1.-dao-yan/1.1-ru-men.md).

# 1.1 入门

在《krc-2e》中文版里讲到这句话，学习一门新程序设计语言的唯一途径就是使用它编写程序。对于所有语言的初学者来说，编写的第一个程序几乎是相同的。

{% code title="1.1.1 main.c" lineNumbers="true" %}

```c
#include <stdio.h>
int main()
{
    return 0;
}
```

{% endcode %}

{% code title="1.1.2 hello.c" lineNumbers="true" %}

```c
#include <stdio.h>  //打招呼 
int main()
{
    printf("xxx");
    return 0;
}
```

{% endcode %}

printf() 函数，是库里的，而不是 c 语言本身自带的，那就需要给库里放 printf() 函数的老大爷，打个招呼。

```
<stdio.h> std  standard 标准 io 输入输出
```

从生活化的角度学习 c 语言是一个不错的角度。

这里提到一个 转义字符序列  为表示无法输入的字符或不可见字符提供了一种机制（详见 p3）。

{% code title="1.1.3 hello.c" lineNumbers="true" %}

```c
#include <stdio.h>  //打招呼 
int main()
{
    printf("xxx\n");
    return 0;
}
```

{% endcode %}
