当前位置:网站首页>Return keyword
Return keyword
2022-07-06 22:31:00 【It's Beichen not too PI acridine】
return keyword
return Used to terminate a function and return the following value to the caller of the function .
return Keyword exit function running at the same time , What kind of data is returned to the function ? What kind of data is it ? yes int type ?char type ? still void type ?
Actually ,return The data type returned is determined by the function definition , When defining a function , Yes “ Return data type ” Such a property , It determines return Data type returned .
return (Val);// This bracket can be omitted . But generally do not omit , Especially when returning the value of an expression .
return What can be returned ? Here's an example :
char * Func(void)
{
char str[30];
…
return str;
}
str It's a local variable , In stack memory , stay Func Released at the end , So back str Will lead to mistakes .
return Statement cannot return to point to “ Stack memory ” Of “ The pointer ”, Because there is a function in the body is automatically destroyed at the end of .
Is there a problem with this statement ? If there is no problem , What is the return ?
return ;
There is no problem with the statement .
But there is a premise , Is in void This can only be used in functions of type , The function is to end this function , The statements after this statement are not executed .
边栏推荐
- 自定义 swap 函数
- Management background --5, sub classification
- Lora sync word settings
- Spatial domain and frequency domain image compression of images
- 做接口测试都测什么?有哪些通用测试点?
- npm无法安装sharp
- MySQL ---- first acquaintance with MySQL
- Classification, function and usage of MySQL constraints
- Leetcode: interview question 17.24 Maximum cumulative sum of submatrix (to be studied)
- 第3章:类的加载过程(类的生命周期)详解
猜你喜欢
Aardio - 封装库时批量处理属性与回调函数的方法
RESNET rs: Google takes the lead in tuning RESNET, and its performance comprehensively surpasses efficientnet series | 2021 arXiv
C# 三种方式实现Socket数据接收
Memorabilia of domestic database in June 2022 - ink Sky Wheel
Installation and use of labelimg
Data processing skills (7): MATLAB reads the data in the text file TXT with mixed digital strings
Unity3d minigame-unity-webgl-transform插件转换微信小游戏报错To use dlopen, you need to use Emscripten‘s...问题
在IPv6中 链路本地地址的优势
Export MySQL table data in pure mode
云原生技术--- 容器知识点
随机推荐
The nearest common ancestor of binary (search) tree ●●
每日一题:力扣:225:用队列实现栈
Research and investment strategy report of China's VOCs catalyst industry (2022 Edition)
MySQL教程的天花板,收藏好,慢慢看
PVL EDI project case
二分图判定
Leetcode question brushing (XI) -- sequential questions brushing 51 to 55
AdaViT——自适应选择计算结构的动态网络
Leetcode exercise - Sword finger offer 26 Substructure of tree
【无标题】
C# 三种方式实现Socket数据接收
0 basic learning C language - interrupt
memcached
MySQL ---- first acquaintance with MySQL
2022-07-05 stonedb的子查询处理解析耗时分析
Spatial domain and frequency domain image compression of images
sizeof关键字
UE4蓝图学习篇(四)--流程控制ForLoop和WhileLoop
Notes de développement du matériel (10): flux de base du développement du matériel, fabrication d'un module USB à RS232 (9): création de la Bibliothèque d'emballage ch340g / max232 SOP - 16 et Associa
Inno Setup 打包及签名指南