当前位置:网站首页>[C language] a brief introduction to the first C language program and data type
[C language] a brief introduction to the first C language program and data type
2022-07-19 09:57:00 【Lixinze__】
The compiler I use is vs2019, After we create the project and create the source file , You can write code happily , Next we will write the first C Language program .
ordinary C Language program
First , To write the main function (main function ).
#include<stdio.h>
int main()
{
printf("hello, world!")
return 0;
}main A function is a function of a program entrance ,C The language code starts from the first line of the main function . There can be more than one in a program .c file , But many ,c In file There can only be one main function .
printf It's a library function , It's a print function , Role is Print information on the screen .
The use of library functions should Header file in source file (printf The header file for is stdio.h).
Let's write the first simple C Language program , Next, let's look at data types .
Get to know the data type
There are differences between different data types , Some data types represent Numbers , Some indications character .C Identify and use these data types through some basic data types . The data types are as follows :
char // Character data type
short // Short
int // integer
long // Long integer
long long // Longer plastic surgery
float // Single-precision floating-point
double // Double precision floating point
- int Keywords can represent the most basic Integer types .
- short、long、long long All are Variant of integer type .
- char Keywords can Specify letters and other characters , It's fine too Represents a smaller integer .
- float、double Express Number with decimal point , The difference is that double More accurate .
Types created by these keywords , Computer storage methods can be divided into these two basic types : Integer types and Floating point type .
Next, let's introduce the Company
- bit - bits ( It's in the computer Minimum Company , Used to store a binary bit )
- byte - byte —>1 byte = 8 bit
- kb = 1024 byte
- mb = 1024 kb
- gb = 1024 mb
- tb = 1024 gb
- pb = 1024 tb
sizeof --- keyword ---- The operator --- Be able to calculate the space occupied by types or variables

In this way, you can visually see the space occupied by different data types , The unit is byte .
边栏推荐
- Database overview
- Huawei wireless devices are configured with static load balancing
- Chapter 13 set/ multiset of STL
- 标准化、归一化和正则化的关系
- [565. Array nesting]
- 金纳米粒子修饰MIL-101骨架材料(AuNPs/MIL-101)/负载COF-TpPa-1(Au NPs/COF-TpPa-1)|齐岳试剂
- [C language] storage of shaping data
- 硫化铜纳米粒/ZIF-8复合材料([email protected]载体)|UiO-66/CoSO复合材料|ZIF-67纳米晶表面修饰六咪唑环三磷腈
- Chapter 10 stack of STL
- Part I - Fundamentals of C language_ 1. Overview of C language
猜你喜欢

第4章-一阶多智体系统一致性 -> 领航跟随系统一致性

Chapter VIII vector of STL

Clwy authority management (II) -- user module

UiO-66-(COOH)2改性聚酰胺纳滤膜|ZIF-8/PVP复合纳米纤维膜|UiO-66-NH2改性聚酰胺纳滤膜

CLWY权限管理(三)--- 用户组模块

MySQL -- SQL optimization case -- implicit character encoding conversion

金纳米粒子修饰MIL-101骨架材料(AuNPs/MIL-101)/负载COF-TpPa-1(Au NPs/COF-TpPa-1)|齐岳试剂
[email protected](Fe)复合纳米材料"/>金属有机骨架材料/聚合物复合材料ZIF-8/P(TDA-co-HDA)|氧化锌[email protected](Fe)复合纳米材料

Implement word segmentation for text and draw word cloud
[email protected]|负载CQDs的FeMIL101材料|mof试剂"/>钴铁双金属有机骨架Cox/MIL-100(Fe)|光敏剂@[email protected]|负载CQDs的FeMIL101材料|mof试剂
随机推荐
PTA 1037 change at Hogwarts
第4章-一阶多智体系统一致性 -> 连续时间含时延系统一致性【程序代码】
Develop the first Flink app
Part I - Fundamentals of C language_ 3. Operators and expressions
FAW Toyota Asia lion's first product refresh
齐岳供应负载亚甲基蓝的CuMOF纳米晶|原位生长在泡沫镍上FeMOF纳米片|氧化物纳米线/ZIF系MOFs糖葫芦状复合材料
Chapter VIII vector of STL
Detailed explanation of C51 common data types
Part I - Fundamentals of C language_ 5. Arrays and strings
Clwy permission management (III) -- user group module
D. Mark and Lightbulbs
Mutual access between components
Vim详解
Part I - Fundamentals of C language_ 4. Procedure flow structure
关于基础模块中的依赖由微服务中的子模块继承的时候依赖失效的问题
Code to celebrate the Dragon Boat Festival -- Zong your heart
[C language] data type and meaning
Mysqldump full recovery to another new instance, and then perform flush privileges analysis
Memory LDA LDA in Blas level-3 sgemm cublesgemmex cubulassgemm
Pytorch calls cublasltmattmul to do GEMM and add bias. It's well written