当前位置:网站首页>[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 .
边栏推荐
- 氨基的金属-有机骨架材料Fe-MOF,Fe-MIL-88NH2|Zr基金属-有机骨架催化剂(Pt-UiO-66)|齐岳生物
- Build a server environment with node+express
- Develop the first Flink app
- Clwy permission management (I) -- project construction
- Es restful operation
- 565. 数组嵌套 / 剑指 Offer II 001. 整数除法
- fastadmin with 和 filed 合用导致field失效
- sqli-labs(less-11)
- Chapter 12 list of STL
- 硫化铜纳米粒/ZIF-8复合材料([email protected]载体)|UiO-66/CoSO复合材料|ZIF-67纳米晶表面修饰六咪唑环三磷腈
猜你喜欢
[email protected]载体)|UiO-66/CoSO复合材料|ZIF-67纳米晶表面修饰六咪唑环三磷腈"/>硫化铜纳米粒/ZIF-8复合材料([email protected]载体)|UiO-66/CoSO复合材料|ZIF-67纳米晶表面修饰六咪唑环三磷腈
![[C language] user defined type elementary knowledge points](/img/73/d225a0d93d11e1efd5b2446996e1fa.png)
[C language] user defined type elementary knowledge points

Anaconda and jupyter notebook entry level detailed tutorial
[email protected](Fe)复合纳米材料"/>金属有机骨架材料/聚合物复合材料ZIF-8/P(TDA-co-HDA)|氧化锌[email protected](Fe)复合纳米材料

FAW Toyota Asia lion's first product refresh

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

565. Array nesting / Sword finger offer II 001 Integer division

状态码的故事

Clwy authority management (II) -- user module

Clwy permission management (III) -- user group module
随机推荐
Clwy permission management (I) -- project construction
第4章-一阶多智体系统一致性 -> 领航跟随系统一致性【程序代码】
pip和pip3的区别用法详解
Database overview
Rhcsa day 1 7.11
Among China's top ten national snacks, it is actually the first
565. Array nesting / Sword finger offer II 001 Integer division
[fishing artifact] UI library second low code tool - form part (II) sub control
How to correctly execute jedis unit test
Implement word segmentation for text and draw word cloud
第1周学习:深度学习入门和pytorch基础
sqli-labs(less-11)
第一部分—C语言基础篇_1. C语言概述
D. Mark and Lightbulbs
死锁、线程与进程讲解
mof定制材料|双金属CuNi-MOF纳米材料|核—壳结构[email protected]纳米复合材料|ZIF-8/聚偏氟乙烯复合纳米纤维膜PVDF
硫化镉负载MIL-125(Ti)|链霉亲和素(SA)-锆基卟啉MOF复合材料([email protected])|壳核结构
Detailed explanation of C51 common data types
UiO-66-(COOH)2改性聚酰胺纳滤膜|ZIF-8/PVP复合纳米纤维膜|UiO-66-NH2改性聚酰胺纳滤膜
rhcsa 第一天 7.11