当前位置:网站首页>Stop pulling, stop pulling, read it in pieces
Stop pulling, stop pulling, read it in pieces
2022-07-21 20:33:00 【Cold hands a】
/*
The last battle
Finish this game , basic C A general review
keyword ( Also called reserved words , See P It's the parking lot , See keywords , It is a symbol with a mark in )
Keywords cannot be created by themselves C Provided You can't do variable names
*/ Circled in red ( What to talk about ), We have seen others , Also mentioned
//auto Declare automatic variables
#include<stdio.h>
int main()
{
{
auto int number = 100;// local variable
//auto Declare automatic variables ( Every local variable is auto Embellished , Automatic creation and automatic destruction are automatic variables ,auto Omit not to write )
int number2 = 120;
//auto Omit
}
return 0;
}
//continue End the current cycle , Start next cycle
#include<stdio.h>
int main()
{
int frequency = 1;
for (frequency = 1; frequency <= 50; frequency++) {
if (frequency == 25) {
continue;// When the conditions are met (25), End the current cycle , Start next cycle , So I can't print 25
}
printf(" Number of prints :%d\n", frequency);
}
return 0;
}
//extern Declare that variables or functions are defined in other files or other locations in this file
#include<stdio.h>
extern number_one;
int main()
{
printf("%d\n", number_one);
return 0;
}
//extern( Declaring external symbols ) You also understand it as using strlen function , Understand it like calling header file
//go to sentence Jump statements without conditions The example I give is not very good , Code loop , Focus on understanding
//#include<stdio.h>
//int main()
//{
// printf("1 Don't go to Myanmar \n");
// GG:// Transfer location , Be sure to add. :( The colon )
// printf("2 Don't go to Myanmar \n");
// printf("3 Don't go to Myanmar \n");
// goto GG;// goto It's the portal To where ? Transferred to the GG The place of
// printf("1 Don't go to Myanmar \n");// Never execute
// return 0;
//}
//register Declare register variables
#include<stdio.h>
int main()
{
register int number = 100;// It is recommended to put this value in the register ( Whether to put it or not depends on the compiler , Just suggest )
return 0;
}
/*
register ???
Let's start with a question , Where can the data be stored ? Network disk ( Baidu network disk ah what ) Hard disk (C disc ,D Plate, etc. ) Memory Advanced caching register Do you find that the faster the speed from left to right , The smaller the space
In order to improve the computer speed , Computers will put a lot of frequently used data on register in When you can't find it in the register Find advanced cache Layers down In this way, the speed increases a lot
*/
//static Declare static variables 3 A role ; 1. Modify local variables
#include<stdio.h>
void Test() {
static int number = 0;//static After modification , Local variables do not die , It extends the life cycle Keep the last number++ The results of the implementation of
number++;
printf("%d\n", number);
}
int main()
{
int frequency = 0;
while (frequency < 10) {
Test();
frequency++;
}
return 0;
}
2. Modify global variable ( Thank you, brother Peng )
3. Modify function ( Thank you, brother Peng )
//static Changing the life cycle of local variables , Essentially, it changes the storage type of data
// The storage types of data are The stack area ( Store local variables and function parameters , You can understand it as storing temporary ) Heap area ( Dynamic memory allocation , You can understand that there are always changes ) Static zone ( Deposit static Decorated things and static variables , You can understand it as stored for a long time )
//static Modify global variable And the function when , It can only be used in this document static Something to decorate ,extern You can't even come
//typedef Used to alias data types ( Is to change the name )
#include<stdio.h>
typedef double decimal;// use decimal To express double type
int main()
{
double number = 3.14;
decimal number2 = 3.1415;
printf("%lf\n", number2);
return 0;
}
//union Type of community ; volatile Explain that variables can be implicitly changed during program execution ; Let's not talk about these two first
// Thank you for your company all the way , A general summary C
End of the flower ! End of the flower ! It's over and flowers are scattered
边栏推荐
猜你喜欢
随机推荐
如何通过IP共享文件
深度剖析 —— 数据
Deep analysis recursion
Hetai 32 onenet WiFi module - Hetai MCU data cloud through mqtt protocol (II)
Codeforces 1642B Power Walking
LaTeX:导数相关符号
无法从“boost::shared_ptr<pcl::RangeImage>”转换为“const std::shared_ptr<const pcl::PointCloud<pcl::PointWit
PointNet++S3DIS数据集训练报错记录
受控组件和非受控组件的区别
Account class
Operating instructions for opt101 monolithic photodiode and single power supply mutual resistance amplifier
D. Insert a progression (Mathematics)
OneNote plug-in, cloud expansion
原型、原型链、构造函数、实例的关系
从一个点云中提取一个子集
三子棋
printf 详解 - 你所不知道的printf用法
(剑指offer版)字符串逆置
Stm32f407-ov7670 (no FIFO) -onenet- upload camera pictures to onenet (EDP protocol)
深度剖析 string —— strcat & strncat