一.C语言的发展历史:
二进制指令---->汇编语言---->B语言---->C语言(肯.汤姆森与丹尼斯.里奇发明)---->ANSI C制定标准C89、C90、C11、C99......
二.main函数:
int main()
{
return 0;
}
main函数是程序的入口,有且仅有一个!
三.库函数:
1.库函数是为了避免重复写一些简单的函数而被创建的;
2.使用库函数时必须包含头文件,如:
printf(打印数据)-------需包含<stdio.h>
#include<stdio.h>
int main()
{
printf("Hello World!");
return 0;
}
strlen(数字符串长度)------需包含<string.h>
#include<string>
int main()
{
strlen("abcdef");
return 0;
)
bool(布尔类型)--------需包含<stdbool.h>
#include<stdbool.h>
int main()
{
bool a=ture;
return 0;
}
这里给大家一个链接,可以帮助大家更好地检索各个库函数所需要包含的头文件:
https://cplusplus.com/reference/clibrary/
四.关键词:
常见的关键词:
循环:for,while,do while, break,continue
分支:if else,switch,case,default,goto
数据类型:char,short,int,long,long long,float,double,signed(有符号的),unsigned(无符号的)
其他:enum(枚举),steuct(结构体),union(联合体),const(常属性),sizeof(计算大小),tyoedef(类型重命名),void(函数的返回类型,函数参数),return(函数返回值),extern(声明外部符号),register(寄存器),static(静态的)......
注:关键词不能自己创建,创建的标识符也不能和关键词重名!!!
int for=0;
//标识符for和关键词for重名,程序会报错!
这里给大家一个关键词的表方便大家查阅:C 关键词 - cppreference.com
五:占位符:
常用占位符:%d----整形,%c----char型,%s----字符串,%f----float型,%lf----double型,%p----地址,%zu或%zd----sizeof返回值
下面举一个例子:
#include<stdio.h>
int main()
{
int a = 0;
printf("%d\n",a);
return 0;
}
六,ASCII表
十进制中0-127的数字都可以用ASCII表中对应的字符输出