当前位置:网站首页>C语言知识点(二)
C语言知识点(二)
2022-07-31 05:18:00 【Awake1234】
基本内置类型
1.整型:带符号的整型(int),带符号短整型(short int)
长整型(long int),unsigned int(无符号整型) unsigned short int(无符号短整型) unsigned long(无符号长整型)
2.void:可以表示没有数据,也可以表示某种任意类型的数据
3.static 修饰变量,该变量空间独立于函数中的auto变量或者栈变量
static变量空间在内存中的静态区内分配
4.extern 变量名 在任何函数体外声明或定义变量时,不加extern可能是定义也可能是声明,但加extern肯定是声明
5.auto 变量:意味着当前变量的作用域为当前函数或代码段的局部变量
6.栈:有的编译器为了提高效率,出栈时不会进行数据清空
7.register:变量的值通常保存在内存中,cpu对变量进行读取先将变量的值从内存读到寄存器中然后进行运算,运算后将结果返回到内存中
(注意:1寄存器变量是单个变量,变量长度应该小于等于寄存器长度
2不能对寄存器变量使用&,因为该变量没有内存地址
3尽量在大量频繁操作时使用寄存器变量,且声明的变量个数应该尽量少)
8.volite类型的变量不管其值有没有变化,每次对其值进行访问时,都会从内存里寄存器里读取,从而能保证数据的一致,做到表里如一
9.typedef:关键字
10.typedef 与#define的比较:
typedef char * p_str1;
#define p_str2 char *;
p_str1 s1,s2;
p_str2 s3,s4;
解析:s1,s2,s3被定义为char *,s4被定义为char,因为#define只是简单的字符串替换,而typedef则是为一个类型起新名字
11.枚举
enum color
{
GREEN = 1,
RED, //red = 2
BLUE, //blue = 3
GREEN_RED = 10,
GREEN = BLUE
}colorval
注:如果常量没有被赋值则从被赋值的常量开始一次加1,如果都没有被赋值,则从0开始依次加1
12.联合体(union):各成员共享一段内存空间,一个联合变量的长度等于各成员中最长的长度,每次有效的成员只有一种
当多个数据类型或符合数据结构要占用同一片内存时我们要使用联合体,当多种数据类型,多个对象,多个事物只取其一时,我们也可以使用联合体来发挥其长处
边栏推荐
- IDEA overview and installation and debugging
- mPEG-DMPE Methoxy-polyethylene glycol-bismyristyl phosphatidylethanolamine for stealth liposome formation
- DingTalk Enterprise Internal-H5 Micro Application Development
- 多线程截取视频为每帧
- Tensorflow steps on the pit while using it
- 会话和饼干,令牌
- 钉钉企业内部-H5微应用开发
- CLS-PEG-FITC Fluorescein-PEG-CLS 胆固醇-聚乙二醇-荧光素简介
- DSPE-PEG-Biotin,CAS:385437-57-0,磷脂-聚乙二醇-生物素可延长循环半衰期
- Four common ways of POST to submit data
猜你喜欢

Cholesterol-PEG-Thiol CLS-PEG-SH 胆固醇-聚乙二醇-巯基

MySQL free installation download and configuration tutorial

Log jar package conflict, and its solution

Image binarization processing of opencv

在 AWS 上从零开始设置 Incredibuild 构建系统

wangeditor编辑器内容传至后台服务器存储

DSPE-PEG-Biotin, CAS: 385437-57-0, phospholipid-polyethylene glycol-biotin prolongs circulating half-life

Picture-in-Picture API in the browser

2021年软件测试面试题大全

【Rhapsody学习笔记】1:Hello World
随机推荐
Pytorch study notes 10 - detailed explanation of convolutional neural network and application of multi-classification task of mnist dataset
解决nx安装 jtop问题
Phospholipids-Polyethylene Glycol-Active Esters for Scientific Research DSPE-PEG-NHS CAS: 1445723-73-8
crontab timing operation
【Rhapsody学习笔记】2:Count Down
Pytorch study notes 13 - Basic_RNN
When solving background-size:cover, the picture is covered but not displayed completely?
Virtual machine view port number process
Detailed explanation of mysql transaction principle
MW: 3400 4-Arm PEG-DSPE four-arm-polyethylene glycol-phospholipid a saturated 18-carbon phospholipid
mPEG-DMPE Methoxy-polyethylene glycol-bismyristyl phosphatidylethanolamine for stealth liposome formation
Redis-哈希
学习JDBC之获取数据库连接的方式
2021年开发人员的绊脚石:构建时间长
自己设置的私密文件,在哪找
UR3机器人运动学分析之正运动学分析
DSPE-PEG-Azide DSPE-PED-N3 磷脂-聚乙二醇-叠氮脂质PFG
DingTalk H5 micro-app login authentication
Rejection sampling note
box-shadow相关属性