当前位置:网站首页>C language from entry to soil (I)
C language from entry to soil (I)
2022-07-24 07:06:00 【Bubble milk】
1、 first C Language program
Study C Language is the first thing to know C The basic framework of language
This is the standard C Language The standard The main function is written ( need Keep in mind )
#include <stdio.h>
int main()
{
// sentence
return 0;
}In some books, you can see the following two ways
#include <stdio.h>
void main()
{
// sentence
}#include <stdio.h>
main()
{
// sentence
}These are relatively early ways of writing , You can meet
understand :c Language is based on a house ,main Function is quite a gate ( The main door ),PS: There will be a side door ( This is equivalent to a custom function ), But use these side doors , Always step into the main door first
2、 data type
| type | Express | Size of bytes accessed Company ( The bit - bit - B) | Output format |
| char | Character | 1 | %c / %s ( character string ) |
| short | Short | 2 | %hd |
| int | integer | 4 | %d |
| long | Long integer | 4 | %ld |
| long long | long long | 8 | %lld |
| float | Single precision floating point | 4 | %f |
| double | Double precision floating point | 8 | %lf |
Learn early C It's enough to know these when speaking
3、 Constants and variables
3.1、 What is? Constant ? Variable ?
(1) Constant
stay C In language , Frequently used Constant value To represent a constant
for example :
3.14;
2022;
666;(2) Variable
Empathy , stay C In language , The value may change at any time It's a variable
stay C In language , To use variables , First of all, know what you are going to use The type of variable , And then for this variable Take a name
for example :
int i; // It defines a The type is integer , The name is i The variable of
char ch;// It defines a The type is Character , The name is ch The variable of 3.2、 Define the representation of variables
int i = 1;// by Variable i Initialize to 1
char ch = 'a';// by Variable ch Initialize to character a3.3、 Classification of variables
(1) Global variables
understand : stay Curly braces { } outside The variable is the global variable
(2) local variable
understand : stay Curly braces { } Inside Variables are local variables
(3) Be careful :
1、 Variable must be in front ( Whether global or local )
2、 The same variable name cannot be defined repeatedly
3、 When the name of the global variable is the same as that of the local variable , Priority local variable
Examples are as follows :

Conclusion
All right. , That's all for this issue , I hope everyone can achieve their goals , Come on , Strive to achieve a higher level , See you next time , Bye-bye

边栏推荐
- Processing tree structured data
- SPI——发送16位和8位数据
- Don't care too much about what others think of you
- 聚合型新生态模式-分享购,会员及奖励制度
- 一首伟大的赞歌
- Thinking of data analysis -- analyzing the retail industry as a whole -- an all-round and multifaceted detailed analysis
- (note sorting is not completed) [graph theory: find the shortest path of single source]
- Lambda expressions sort list objects in multiple fields
- Prompt for garbled code when CHM file is opened
- Vs debugging
猜你喜欢

华为专家自述:如何成为优秀的工程师

Do you really know the judgement sentence?

Ue4/5 cannot open the file "xxx.generated.h" (cannot open file xxx.generated.h) solution summary

Redis.conf details

UE4/5 无法打开文件“xxx.generated.h”(Cannot open file xxx.generated.h)的解决方法总结

An AI plays 41 games, and the comprehensive performance score of Google's latest multi game decision transformer is twice that of dqn

安装snownlp包过程出现Requirement already satisfied:及Read timed out.问题解决方法

Create WPF project

济南人社已签1W+电子劳动合同,法大大助力HR数字化

Penetration learning - SQL injection - shooting range - installation and bypass experiment of safety dog (it will be updated later)
随机推荐
(笔记整理未完成)【图论:求单源最短路径】
Redis special data type hyperloglog
lambda表达式对list对象进行多字段排序
项目问题积累
你不可能让每个人都满意!
先爱自己,再爱别人。
/etc/rc. Local setting UI program startup and self startup
OSS authorizes a single bucket permission
树莓派换源
5. Template cache. Drawing a square can only move within the triangle
2022-07-22 mysql/stonedb并行hashJoin内存占用分析
JMeter笔记2 | JMeter原理及测试计划要素
反射
Camera Hal OEM模块 ---- cmr_grab.c
vs2019配置运行open3d例子
【C语言】操作符详解(深入理解+整理归类)
Upload excel file
"Big factory interview" JVM Chapter 21 questions and answers
Redis special data type bitmap
Metaltc5.0 realizes webrtc version IPC of Junzheng pure C