当前位置:网站首页>Fifth Bureau akali teaching Bureau
Fifth Bureau akali teaching Bureau
2022-07-21 20:33:00 【Cold hands a】
/*
Let's talk about The pointer
Will be equivalent to a source file you create a shortcut , Right click shortcut --> Where to open the file ; Then you move the source file , You'll find that , No matter how your source files move , But you can find the location of the shortcut to open the file
This is equivalent to a pointer , Yours Wegame open lol In fact, it is also a pointer
*/
First step
The second step
The third step
The first 4 Step
Step five :
#include<stdio.h>
int main()
{
int number = 100;
int* point = &number;//int*( Shaping the pointer ), Because the number is int type ; Right click the target of the attribute in the shortcut to store the address , therefore &number(number The address of );point It's a pointer variable
printf("%p\n", &number);//%p It's a printed address
printf("%d\n", *point);//*p Is dereference , You can understand it as double clicking the shortcut ( Open shortcut )
*point = 200;
printf("%d\n", *point);// It is equivalent to opening shortcut modification ( open word Document modification or something )
// How much space does a pointer occupy ?
printf("%d\n", sizeof(char*));
printf("%d\n", sizeof(short*));
printf("%d\n", sizeof(int*));
printf("%d\n", sizeof(long*));
printf("%d\n", sizeof(long long*));
printf("%d\n", sizeof(float*));
printf("%d\n", sizeof(double*));
return 0;
}
// The pointer size is the same Pointers are used to store addresses How big is the address , How much space is the pointer ( The ID number on the ID card , That piece of land can be lost , I care about you fat, thin, tall, short )
//
// // I am 64 Bit , So the pointer size is 8 byte ;32 It's about 4
32 position :
64 position :
*
Tell me about just now printf("%p\n", &number); How did you get your address number
First of all, computers have 32(x86) Bit operating system and 64(x64) Bit operating system
With 32 Bit operating system, for example 32 Namely 32 Root address line , There are positive and negative charges after power on Electrical signals are converted into digital information 0 and 1
This is why computer language is a binary language
0 and 1 A total of 2^32 An orderly sequence of numbers ( Memory unit )
then 2^32 / 8 = ??? Divide bytes again 1024 Wait, you can calculate
If you take a bit as an address , One char To occupy 8 An address , Is this a little too wasteful
therefore C May dictate A memory unit is a byte , Then assign an address
*/
/*--------------------------------------------------------------------
To describe a complex object , So there it is Structure
You can't be used by others int,char Wait to describe , Is he a combination of good looks and intelligence , ha-ha
*/
#include<stdio.h>
struct people {
char name[20];
int EQ;
int IQ;
double height;
};
int main()
{
struct people one = { " Zhang San ", 85, 90, 165.51 };// The first person to create and information ( Structure appears and initializes )
printf("1.%s %d %d %lf\n", one.name, one.EQ, one.IQ, one.height);// The first person . Corresponding information ( Structure member variables )
struct people* point = &one;// Structure pointer
printf("2.%s %d %d %lf\n", (*point).name, (*point).EQ, (*point).IQ, (*point).height);
printf("3.%s %d %d %lf\n", point->name, point->EQ, point->IQ, point->height);//point( Shortcut )->name( Source program )
return 0;
}
Thank you for watching It's a great honor
边栏推荐
- 深度剖析 string —— strchr & strstr
- Deep analysis of string -- memset & memcmp
- In the fourth game, where is the restaurant? Shepherd boy points to Xinghua village from afar and matches several to relieve the pressure on the line
- D. Insert a Progression(数学)
- [C语言]一百个奥特曼大战一百个怪兽 源代码
- 自学编程80余年,这些私藏的实用工具&学习网站陪我走到了现在,必须收藏,学习效率翻倍 - 网站篇
- 小游戏类项目 —— 五子棋游戏
- Deep analysis of string -- strlen & strtok
- Hetai 32 onenet WiFi module - Hetai MCU data cloud through mqtt protocol (II)
- 深度剖析数据在内存中的存储
猜你喜欢
随机推荐
[C语言] 平淡的日子里泛起光 初阶最后的战役
The fifth Bureau, akali teaching Bureau
Stm32f407 based camera (ov7670 without FIFO) image acquisition and LCD display experiment - note sorting
1020 moon cake
1020月饼
(剑指off版)旋转数组求最小值(通俗易懂)
20.【char*与string相等不相等】
Deep analysis of string -- strchr & strstr
再见了,各位(虽然没人会注意到)
Hetai 32 onenet WiFi module - Hetai MCU data cloud through mqtt protocol (I)
[C语言]请将细碎的能力函数与数组飞回光之国
如何通过IP共享文件
1009 irony
D. Insert a Progression(数学)
(good pairs) assign the value of one array to another array
自定义MVC增删改查
OLED (classic 0.96 inch) -4spi--ssd1306 control principle (including common chip _oled routines)
MySQL之账号管理.建库以及四大引擎
矩阵求导常用公式(避坑)+矩阵的模和矩阵的绝对值的求导
从一个点云中提取一个子集