1.1 入门

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

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

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

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

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

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

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

Last updated