先自我介绍一下,小编浙江大学毕业,去过华为、字节跳动等大厂,目前阿里P7
深知大多数程序员,想要提升技能,往往是自己摸索成长,但自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
因此收集整理了一份《2024年最新大数据全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友。
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上大数据知识点,真正体系化!
由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新
如果你需要这些资料,可以添加V获取:vip204888 (备注大数据)
正文
2.1 使用寻址运算符"&"
下面的程序输出一些变量的地址
#define \_CRT\_SECURE\_NO\_WARNINGS
#include "Main.h"
int main()
{
system("color 3E");
// Define some integer variables
long a = 1L;
long b = 2L;
long c = 3L;
// Define some floating-point variables
double d = 4.0;
double e = 5.0;
double f = 6.0;
printf("A variable of type long occupies %u bytes.", sizeof(long));
printf("\nHere are the addresses of some variables of type long:");
printf("\nThe address of a is: %p The address of b is: %p", &a, &b);
printf("\nThe address of c is: %p", &c);
printf("\n\nA variable of type double occupies %u bytes.", sizeof(double));
printf("\nHere are the addresses of some variables of type double:");
printf("\nThe address of d is: %p The address of e is: %p", &d, &e);
printf("\nThe address of f is: %p\n", &f);
system("pause");
return 0;
}
按F5进行编译,运行结果如下所示
A variable of type long occupies 4 bytes.
Here are the addresses of some variables of type long:
The address of a is: 00EFFC60 The address of b is: 00EFFC54
The address of c is: 00EFFC48
A variable of type double occupies 8 bytes.
Here are the addresses of some variables of type double:
The address of d is: 00EFFC38 The address of e is: 00EFFC28
The address of f is: 00EFFC18
请按任意键继续. . .
声明3个long类型的变量和3个double类型的变量
// Define some integer variables
long a = 1L;
long b = 2L;
long c = 3L;
// Define some floating-point variables
double d = 4.0;
double e = 5.0;
double f = 6.0;
2.2 输出变量地址的格式
下来输出long变量占用的字节数,跟着输出这3个变量的地址
printf("A variable of type long occupies %u bytes.", sizeof(long));
printf("\nHere are the addresses of some variables of type long:");
printf("\nThe address of a is: %p The address of b is: %p", &a, &b);
printf("\nThe address of c is: %p", &c);
- 使用%u显示sizeof 生成的值,因为它是无符号的整数。
- 使用一个新的格式说明符%p,来输出变量的地址。
- 这个格式说明符指定输出一个内存地址,其值为十六进制。内存地址一般是32位或64位,地址的大小决定了可以引用的最大内存量。
输出double变量占用的字节数,接着输出这3个变量的地址
printf("\n\nA variable of type double occupies %u bytes.", sizeof(double));
printf("\nHere are the addresses of some variables of type double:");
printf("\nThe address of d is: %p The address of e is: %p", &d, &e);
printf("\nThe address of f is: %p\n", &f);
- 事实上,程序本身不如输出那么有趣。
- 看看显示出来的地址,地址值逐渐变小,是成“等差排列”,如下图所示。
- 在本例中,地址b比a低4,c比b低4。这是因为每个long类型的变量占用4个字节。
- 变量d、e、f也是如此,但它们的差是8。这是因为类型double的值用8个字节来存储。
三、输出数组里面变量的地址
3.1 输入数组里面存储的数据变量的地址
下面的程序将输出数组里面的10变量的地址
int arrays[10];
srand(time(NULL));
for (int i = 0; i < 10; i++)
{
arrays[i] = rand() % 20 + 1;
}
for (int i = 0; i < 10; i++)
{
printf("%d of the address--> %p\n", arrays[i], &arrays[i]);
}
printf("\n");
按F5进行编译,运行结果如下所示
18 of the address--> 010FFE58
17 of the address--> 010FFE5C
4 of the address--> 010FFE60
15 of the address--> 010FFE64
6 of the address--> 010FFE68
12 of the address--> 010FFE6C
9 of the address--> 010FFE70
3 of the address--> 010FFE74
7 of the address--> 010FFE78
13 of the address--> 010FFE7C
请按任意键继续. . .
- 有地址的变化规律可以看出int类型的地址占四个字节。
- 数组中存储的数据地址是呈现递增关系。
3.2 “&数组名”:代表数组首地址
&数组名:是取出数组的首个(第一个)数据的地址。
增加代码如下所示
printf("The array of the address is %p\n", &arrays);
按F5进行编译,运行结果如下所示
13 of the address--> 006FFAC8
18 of the address--> 006FFACC
9 of the address--> 006FFAD0
18 of the address--> 006FFAD4
19 of the address--> 006FFAD8
16 of the address--> 006FFADC
17 of the address--> 006FFAE0
7 of the address--> 006FFAE4
17 of the address--> 006FFAE8
17 of the address--> 006FFAEC
The array of the address is 006FFAC8
请按任意键继续. . .
- 可以看出"&数组名"就是将数组中的第一个变量的地址取出来。
四、完整程序
本文的完整程序如下所示
4.1 Main.h 文件程序
#pragma once
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
4.2 Main.c 文件程序
#define \_CRT\_SECURE\_NO\_WARNINGS
#include "Main.h"
**网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。**
**需要这份系统化的资料的朋友,可以添加V获取:vip204888 (备注大数据)**
![img](https://img-blog.csdnimg.cn/img_convert/7e7f3f0751259b1264f04aad66e57943.png)
**一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**
``
#define \_CRT\_SECURE\_NO\_WARNINGS
#include "Main.h"
**网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。**
**需要这份系统化的资料的朋友,可以添加V获取:vip204888 (备注大数据)**
[外链图片转存中...(img-y7KcQBz8-1713279080992)]
**一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**