当前位置:网站首页>初始c语言时的一些知识
初始c语言时的一些知识
2022-06-25 12:35:00 【LIn_jt】
前言
在学习c语言时,我们会对c语言的各个分类知识进行大致的理解,本文将介绍几种分类的知识(后续将继续补充)
正文
一.第一个c语言程序,请看下图

此处的main函数为程序的入口,一个工程中有且仅有一个main函数。
而第6行的printf函数为打印函数,即在屏幕上输出“ ”之间的内容,程序的结果为:

二.数据类型
1.数据类型是为了定义变量的时候使用,c语言主要提供了以下数据类型:

2.各个数据类型所占的空间
请看以下程序:

此处的sizeof关键字,意为计算一个对象所占的内存的大小,单位为byte,以下为其输出结果:

1 2 4 4 8 4 8(按照上图顺序)即为各个数据类型所占的内存大小。
三.变量与常量
1.变量
变量从字面意思上即为可变的量,而定义变量的方法如下图所示:

(建议在创建变量的时候为变量赋初值。)
2.变量的分类
变量分为两种,一种为局部变量,一种为全局变量。
对于局部变量:即为定义在大括号(代码块)内的变量即为局部变量。
对于全局变量:定义在大括号之外的变量即为全局变量,请看下图:

by the way:当局部变量与全局变量的变量名相同时,局部变量优先:
例:

以上即为初始c语言的知识的一部分内容,后续将会继续更新!
边栏推荐
- [pit avoidance means "difficult"] to realize editable drag and drop sorting of protable
- 用include what you use拯救混乱的头文件
- torch. Tensor splicing and list (tensors)
- WIN10环境下配置pytorch
- Solution to Nacos' failure to modify the configuration file mysql8.0
- Common colors for drawing
- 剑指 Offer II 028. 展平多级双向链表
- mysql导入导出数据到excel表日期出现问题
- Detailed explanation of string operation functions and memory functions
- 量化交易之回测篇 - 期货CTA策略实例(TQZFutureRenkoScalpingStrategy)
猜你喜欢
![[turn] starting from the end, analyze in detail how to fill in the college entrance examination volunteer](/img/77/715454c8203d722e246ed70e1fe0d8.png)
[turn] starting from the end, analyze in detail how to fill in the college entrance examination volunteer

20220620 interview reply

几分钟上线一个网站 真是神器

AGCO AI frontier promotion (6.25)
![[flask tutorial] flask overview](/img/e8/d85ac54f3a9eb3b1ab31852761154c.jpg)
[flask tutorial] flask overview

关于扫雷的简易实现

Maui's learning path (II) -- setting

二叉树之_哈夫曼树_哈弗曼编码

Shenzhen mintai'an intelligent second side_ The first offer of autumn recruitment

[pit avoidance refers to "difficult"] antd cascader implements new customized functions
随机推荐
关于数据在内存中的存储下
剑指Offer 第 2 天链表(简单)
And console Log say goodbye
RESTful和RPC
Optimization of lazyagg query rewriting in parsing data warehouse
德国举行全球粮食安全团结会议
nacos无法修改配置文件Mysql8.0的解决方法
list. replace, str.append
Drawing cubes with Visio
Fedora 35 deploys DNS master-slave and separation resolution -- the way to build a dream
Jupyter notebook theme font setting and automatic code completion
The editor is used every day. What is the working principle of language service protocol?
MySQL learning notes
Include what you use to save chaotic header files
Alibaba stability fault emergency handling process
@Scheduled implementation of scheduled tasks (concurrent execution of multiple scheduled tasks)
[turn] starting from the end, analyze in detail how to fill in the college entrance examination volunteer
Summer Ending
[AI helps scientific research] fool drawing of loss curve
À propos du stockage des données en mémoire