C语言复习day1
包的引用
类似于import
#include <stdio.h>;
记得句末加分号
main()函数
函数名称同样
返回类型 方法名(){
}
数据类型
char ch = 'a'; //字符型
int age = 20; //整型
short num = 10; //短整型
//long
//long long
float weight = 55.5; //单精度浮点型
double height = 10.0; //双精度浮点型
数据类型大小
void main() {
printf("%d\n", sizeof(char)); //1
printf("%d\n", sizeof(short)); //2
printf("%d\n", sizeof(int)); //4
printf("%d\n", sizeof(long)); //4
printf("%d\n", sizeof(long long));//8
printf("%d\n", sizeof(float));//4
printf("%d\n", sizeof(double));//8
printf("char的大小%d\n", sizeof(char));
}
单位为字节
scanf
#define _CRT_SECURE_NO_WARNINGS 1
scanf("%d %d",&a,&b);