当前位置:网站首页>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 .
边栏推荐
- Report on technological progress and development prospects of solid oxide fuel cells in China (2022 Edition)
- 如何用程序确认当前系统的存储模式?
- TypeScript获取函数参数类型
- 空结构体多大?
- Inno setup packaging and signing Guide
- Installation and use of labelimg
- 硬件開發筆記(十): 硬件開發基本流程,制作一個USB轉RS232的模塊(九):創建CH340G/MAX232封裝庫sop-16並關聯原理圖元器件
- Aardio - 利用customPlus库+plus构造一个多按钮组件
- 如何实现文字动画效果
- 云原生技术--- 容器知识点
猜你喜欢

自制J-Flash烧录工具——Qt调用jlinkARM.dll方式

UE4蓝图学习篇(四)--流程控制ForLoop和WhileLoop

LeetCode 练习——剑指 Offer 26. 树的子结构

Advantages of link local address in IPv6

二分图判定

云原生技术--- 容器知识点

NPDP认证|产品经理如何跨职能/跨团队沟通?

Seata aggregates at, TCC, Saga and XA transaction modes to create a one-stop distributed transaction solution

Leetcode exercise - Sword finger offer 26 Substructure of tree

Chapter 3: detailed explanation of class loading process (class life cycle)
随机推荐
leetcode:面试题 17.24. 子矩阵最大累加和(待研究)
Comparison between variable and "zero value"
Unity3d minigame-unity-webgl-transform插件转换微信小游戏报错To use dlopen, you need to use Emscripten‘s...问题
柔性数组到底如何使用呢?
Dealing with the crash of QT quick project in offscreen mode
Heavyweight news | softing fg-200 has obtained China 3C explosion-proof certification to provide safety assurance for customers' on-site testing
Jafka来源分析——Processor
pytorch_YOLOX剪枝【附代码】
RESNET rs: Google takes the lead in tuning RESNET, and its performance comprehensively surpasses efficientnet series | 2021 arXiv
BasicVSR_PlusPlus-master测试视频、图片
That's why you can't understand recursion
MySQL教程的天花板,收藏好,慢慢看
HDR image reconstruction from a single exposure using deep CNN reading notes
Web APIs DOM 时间对象
Learn the principle of database kernel from Oracle log parsing
2022-07-05 stonedb sub query processing parsing time analysis
Aardio - 不声明直接传float数值的方法
Aardio - 利用customPlus库+plus构造一个多按钮组件
Web APIs DOM time object
Report on technological progress and development prospects of solid oxide fuel cells in China (2022 Edition)