C语言概述
且任容枯 Lv4

C语言概述

一个简单的C程序示例

1
2
3
4
5
6
7
8
9
10
11
#include <stdio.h>   // #include 预处理器指令
int main(void){ // main()总是第一个被调用的函数
int num;
num = 1;
printf("I am a simple");
printf("computer\n");
printf("my favorite number is %d because it is first\n",num);
return 0;
}
// I am a simplecomputer
// my favorite number is 1 because it is first

#include <stdio.h>的作用相当于把stdio.h文件中的所有内容都输入到该行所在的位置

关键字

auto extern short while
break float signed _Alignas
case for sizeof _Alignof
char goto static _Bool
const if struct _Complex
continue inline switch _Generic
default int typedef _Imaginary
do long union _Noreturn
double register unsigned _Static_assert
else restrict void _Thread_lcoal
enum return volatile _Atomic