-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path20230606.c
82 lines (70 loc) · 2.08 KB
/
20230606.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include <stdio.h>
#include <string.h>
int Max(int x, int y)
{
if (x > y)
return x;
else
return y;
}
void test()
{
static int a = 1;
a++;
printf("a = %d\n", a);
}
int main()
{
// 求两个数的较大值
// int num1 = 0;
// int num2 = 0;
// int max = 0;
// scanf("%d%d", &num1, &num2);
// max = Max(num1, num2);
// printf("MAX = %d\n", max);
// sizeof
// int a = 10;
// int arr[] = {1, 2, 3, 4, 5, 6};
// printf("%zd\n", sizeof(a));
// printf("%zd\n", sizeof(arr));
// printf("%zd\n", sizeof a);
// printf("%zd\n", sizeof(int));
// ++ --
// int a = 10;
// int b = a++; // 后置++ 先使用 再++ b=10 a=10
// int b = ++a; // 前置++ 先++ 再使用 b=11 a=11
// int b = a--; // 后置-- 先使用 在-- a=9 b=10
// int b = --a; // 前置-- 先-- 在使用 a=9 b=
// printf("a = %d b = %d\n", a, b);
// 强制类型装换
// int a = (int)3.14;
// printf("a = %d\n", a);
// 0-假
// 非0-真
// 只要是整数,内存中存储的都是二进制的补码
// 正数:原码、反码、补码相同
// 负数:补码
// 原码-------------------------->反码------------------->补码
// 直接按照正负 原码的符号位不变 反码+1
// 写出的二进制序列 其他位按位取反得到
// 列:-2
// 10000000000000000000000000000010 - 原码
// 11111111111111111111111111111101 - 反码
// 11111111111111111111111111111110 - 补码
// 关键字
// auto break case char const continue defaule do double else enum
// extern float for goto if long register return short signed
// sizeof static struct switch typeddef union unsigned void volatile while
// typedef - 类型定义 - 类型重定义
// static 静态局部变量,局部变量生命周期变长
// static 修饰全局变量,改变了变量作用域 静态的全局变量只能在自己所在的源文件内部使用,出了源文件无法使用
// static 修饰函数
// int i = 0;
// while (i < 5)
// {
// test();
// i++;
// }
// extern 声明外部符号
return 0;
}