当前位置:网站首页>Learning notes on February 5, 2022 (C language)
Learning notes on February 5, 2022 (C language)
2022-06-25 14:55:00 【Smart_ auspicious】
22/2/5 Learning notes (Part 1)
main function
1、 A project has and There is only one main function .
2、 There can be more than one project .c file .
data type
- char // Character data type ( Can be a specifier )
- short // Short
- int // integer —%d
- long // Long integer
- long long // Longer integers
- float // Single-precision floating-point —%f
- double // Double precision floating point —%lf
The scope and life cycle of variables
- The scope of a local variable : The local scope of the variable .
- Scope of global variables : The whole project .
int g_val = 2022
- The life cycle of a variable is the period of time between the creation and destruction of a variable
Constant
- Literal constants
- const Modified constant variable
const int num = 10; // here num It's a constant ( Properties that cannot be changed ).
- #define Defined identifier constant
#define MAX 10000;
- Enumeration constants enum( Enumeration constants are from... By default 0 Start , Every increase 1. Assignable initial value .)
enum Enumerate class names //(SEX)
{
type 1 //(MALE)
type 2 //(FEMALE)
type 3 //(SECRET)
};
character string + Escape character + notes
- “abcdef” // character string
- \0 // The string hides a... At the end \0 The logo of ( End mark ).[ There is no such thing as .]


little tips
printf(“”); // Print out “”
print("%d\n", 100)`; // Print out an integer “100”
sizeof // keyword - The operator - Calculate the space occupied by the type or variable .
{} Externally defined are global variables , Internally defined are local variables . When local variables and global variables conflict , Local priority .
scanf("%d %d",&a,%b); // User defined , That is, you need to enter

scanf_s function Do not belong to c Language category . Try not to use . If you don't have to use , You can add... To the first line of the entire source file :#define_CRT_SECURE_NO_WARNINGS 1【 Use Notepad to open and copy this command in the programming software , The word will appear in the first line of the newly opened programming page .】
int arr[10] = {0}; // An array of ten numbers
Debugging is very important .
extern Statement
strlen(); //string length Find the length
int len = strlen("abc");
printf("%d\n",len);
边栏推荐
- Is it normal to dig for money? Is it safe to open a stock account?
- p1408
- SPARQL learning notes of query, an rrdf query language
- Study notes of cmake
- QT database connection deletion
- Mutationobserver listens for DOM changes
- How to cut the size of a moving picture? Try this online photo cropping tool
- Qmake uses toplevel or topbuilddir
- The best time to buy and sell stocks
- QQ love talk candy love talk content acquisition and storage
猜你喜欢

Time stamp calculation and audio-visual synchronization of TS stream combined video by ffmpeg protocol concat

It's not easy to understand the data consistency of the microservice architecture for the first time after six years as a programmer

2022年广东高考分数线出炉,一个几家欢喜几家愁

Kubernetes understands kubectl/ debugging

Open a restaurant

【中国海洋大学】考研初试复试资料分享

Jaspersoft studio installation

Flexible layout (display:flex;) Attribute details
![[untitled]](/img/7f/e2c9fbfb5eb6e7fcc6e23a46540933.jpg)
[untitled]

【Try to Hack】vulnhub DC1
随机推荐
QT pop up open file dialog box QFileDialog
Automatic correlation between QT signal and slot
Using Sphinx to automatically generate API documents from py source files
QT opens the print dialog box in a text editor
If multiple signals point to the same slot function, you want to know which signal is triggered.
It's not easy to understand the data consistency of the microservice architecture for the first time after six years as a programmer
14 -- validate palindrome string II
网上股票开户安不安全?有谁知道呢
Design and implementation of thread pool
Source code analysis of synergetics and ntyco
QT file reading -qfile
Compile Caffe's project using cmake
Arithmetic operations and expressions
Does stream even have application advanced learning? As a programmer, you know what
Build a minimalist gb28181 gatekeeper and gateway server, establish AI reasoning and 3D service scenarios, and then open source code (I)
有哪个瞬间让你觉得这个世界出bug了?
HMS core machine learning service realizes simultaneous interpretation, supports Chinese-English translation and multiple voice broadcast
JGG | 河北大学杜会龙组综述植物泛基因组学研究
Use Matplotlib to draw a line chart
Flexible layout (display:flex;) Attribute details