当前位置:网站首页>Several keywords in C language
Several keywords in C language
2022-07-02 05:49:00 【Croxd】
auto: Automatic local variables , Generally, when we define local variables , Namely auto local variable , But omitting it when we write has the same effect , Local variables are stored on the stack .
extern: Life global variable . For example, I a.c Can be defined in int a, b.c I want to call This a But it's not defined , At this time b.c You need to use this a Before the variable , use extern a, To tell a It is defined in other files , You can use it .
static: There are two uses , The first is to modify local variables , It is called static local variable . Static local variables are the same as assigned global variables , Save in data segment , The life cycle is the same . His connection is connectionless .
The second is to modify global variables or modify functions , It turns external links into internal connection properties , Can only be used in this document , Don't want to be called by other files . External connection attributes are ordinary functions and global variables , Connectionless attributes are local variables and static local variables .
register: It is generally used to decorate global variables that are often called . Will put it in the register , For example uboot Medium gd Global variables , Such benefits can improve efficiency . But he tried to put it in the register , Instead of necessarily putting it in the register .
volatile: Variable , Changeable . There are three cases where the value of a variable is unknown ,1. Interrupt the changed value ,2. The same variable used in multithreading ,3. Value of hardware change ( register ), All three compilers cannot know the change of value . So it is used to tell the compiler when it encounters this variable , Don't optimize this variable . So there will be no errors .
const: Often used to define constants , Indicates that this constant cannot be modified . It mainly depends on const Which is the nearest behind , Is to decorate which , near * The value cannot be modified , Close to the variable is the address, which cannot be modified .
- const int * a: Constant pointer , The value cannot be modified , The address pointed to can be modified .
- int * const a: constant pointer , Value can be modified , The address pointed to cannot be modified .
边栏推荐
- [golang syntax] be careful with the copy of slices
- How to change the IP address of computer mobile phone simulator
- Vite打包后的dist不能直接在浏览器打开吗
- mysql事务和隔离级别
- php继承(extends)
- c语言中的几个关键字
- centos8安裝mysql8.0.22教程
- Zzuli:1060 numbers in reverse order
- php读文件(读取文件内含有某字符串的指定行)
- 2022-2-14 learning xiangniuke project - Section 7 account setting
猜你喜欢

all3dp. All Arduino projects in com website (2022.7.1)

Vite打包后的dist不能直接在浏览器打开吗

Fabric. JS gradient

【论文翻译】GCNet: Non-local Networks Meet Squeeze-Excitation Networks and Beyond

Fabric. JS iText set italics manually

Software testing - concept

centos8安装mysql8.0.22教程

Oled12864 LCD screen

Software testing Q & A

How to write good code - Defensive Programming Guide
随机推荐
5g market trend in 2020
Determine whether there is an element in the string type
Taskbar explicit / implicit toggle function
Fabric. JS background is not affected by viewport transformation
Practice C language advanced address book design
c语言中的几个关键字
Zzuli:1060 numbers in reverse order
all3dp.com网站中全部Arduino项目(2022.7.1)
1035 Password
【論文翻譯】GCNet: Non-local Networks Meet Squeeze-Excitation Networks and Beyond
Huawei Hongmeng OS, is it OK?
文件包含漏洞(一)
Vscode paste image plugin saves image path settings
[PHP是否安装了 SOAP 扩]对于php实现soap代理的一个常见问题:Class ‘SoapClient‘ not found in PHP的处理方法
Reflection of the soul of the frame (important knowledge)
Alibaba: open source and self-developed liquid cooling data center technology
Test case
LCD之MIPI协议的一些说明
生成二维码
PHP development and testing WebService (soap) -win