当前位置:网站首页>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 .
边栏推荐
- 如何用程序确认当前系统的存储模式?
- 【雅思口语】安娜口语学习记录part1
- Assembly and Interface Technology Experiment 6 - ADDA conversion experiment, AD acquisition system in interrupt mode
- Research and investment strategy report of China's VOCs catalyst industry (2022 Edition)
- Self made j-flash burning tool -- QT calls jlinkarm DLL mode
- 【踩坑合辑】Attempting to deserialize object on CUDA device+buff/cache占用过高+pad_sequence
- MySQL教程的天花板,收藏好,慢慢看
- (十八)LCD1602实验
- 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
- 重磅新闻 | Softing FG-200获得中国3C防爆认证 为客户现场测试提供安全保障
猜你喜欢
Mysql database basic operations DML
MySQL----初识MySQL
ResNet-RS:谷歌领衔调优ResNet,性能全面超越EfficientNet系列 | 2021 arxiv
Seata聚合 AT、TCC、SAGA 、 XA事务模式打造一站式的分布式事务解决方案
Web APIs DOM time object
RESNET rs: Google takes the lead in tuning RESNET, and its performance comprehensively surpasses efficientnet series | 2021 arXiv
Learn the principle of database kernel from Oracle log parsing
Signed and unsigned keywords
硬件开发笔记(十): 硬件开发基本流程,制作一个USB转RS232的模块(九):创建CH340G/MAX232封装库sop-16并关联原理图元器件
新手程序员该不该背代码?
随机推荐
TypeScript获取函数参数类型
Learn the principle of database kernel from Oracle log parsing
Sword finger offer question brushing record 1
Leetcode exercise - Sword finger offer 26 Substructure of tree
PVL EDI 项目案例
UVa 11732 – strcmp() Anyone?
NPDP认证|产品经理如何跨职能/跨团队沟通?
ThreadLocal详解
Export MySQL table data in pure mode
Build op-tee development environment based on qemuv8
Data storage (1)
【LeetCode】19、 删除链表的倒数第 N 个结点
extern关键字
2014阿里巴巴web前实习生项目分析(1)
数据处理技巧(7):MATLAB 读取数字字符串混杂的文本文件txt中的数据
Memorabilia of domestic database in June 2022 - ink Sky Wheel
Daily question 1: force deduction: 225: realize stack with queue
Management background --5, sub classification
NPDP certification | how do product managers communicate across functions / teams?
BasicVSR_PlusPlus-master测试视频、图片