C语言学习笔记(一)
什么是C语言
对于c语言的直观印象就是关于人机对话,如何用人类语言指挥计算机以达成想要的目的。
一些基本知识
1 tybe=8 bit
1 K=1024 tybe
1 M= 1024 K
1 G=1024 M
1 T=1024 G
一个整符字节包含四 bit。
基本的字符含义以及命令
/example1_1.c 在屏幕上输出字符/ //注释
#include<stdio.h>
// 调用数据库
main()
{
printf("Hello World!“/n);
// /n为换行字符,注意每一句完结符号;
}
/* example1_2.c 计算角度的余弦*)
#include <stdio.h>
#include <math.h>
main()
{
double x,s;
printf(“Please input value of x:”);
scanf("%lf",&x);
// scanf为输入函数 %为格式符号 lf=long float 对应 double 双精度词 &为取缔指令
s=cos(x);
printf(“cos(%lf)=%lf\n”,x,s);
}