当前位置:网站首页>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 .
边栏推荐
- 将MySQL的表数据纯净方式导出
- 做接口测试都测什么?有哪些通用测试点?
- 自制J-Flash烧录工具——Qt调用jlinkARM.dll方式
- Senior soft test (Information System Project Manager) high frequency test site: project quality management
- 硬件開發筆記(十): 硬件開發基本流程,制作一個USB轉RS232的模塊(九):創建CH340G/MAX232封裝庫sop-16並關聯原理圖元器件
- MySQL教程的天花板,收藏好,慢慢看
- Seata aggregates at, TCC, Saga and XA transaction modes to create a one-stop distributed transaction solution
- 枚举与#define 宏的区别
- OpenNMS分离数据库
- 手写ABA遇到的坑
猜你喜欢
CocosCreator+TypeScripts自己写一个对象池
Improving Multimodal Accuracy Through Modality Pre-training and Attention
NetXpert XG2帮您解决“布线安装与维护”难题
NPDP certification | how do product managers communicate across functions / teams?
uniapp滑动到一定的高度后固定某个元素到顶部效果demo(整理)
labelimg的安装与使用
Hardware development notes (10): basic process of hardware development, making a USB to RS232 module (9): create ch340g/max232 package library sop-16 and associate principle primitive devices
That's why you can't understand recursion
Assembly and interface technology experiment 5-8259 interrupt experiment
Should novice programmers memorize code?
随机推荐
MySQL约束的分类、作用及用法
硬件開發筆記(十): 硬件開發基本流程,制作一個USB轉RS232的模塊(九):創建CH340G/MAX232封裝庫sop-16並關聯原理圖元器件
Sword finger offer question brushing record 1
Chapter 4: talk about class loader again
如何实现文字动画效果
将MySQL的表数据纯净方式导出
【LeetCode】19、 删除链表的倒数第 N 个结点
Data processing skills (7): MATLAB reads the data in the text file TXT with mixed digital strings
Daily question 1: force deduction: 225: realize stack with queue
二分图判定
Leetcode question brushing (XI) -- sequential questions brushing 51 to 55
Aardio - 不声明直接传float数值的方法
UVa 11732 – strcmp() Anyone?
Assembly and interface technology experiment 5-8259 interrupt experiment
Mysql database basic operations DML
每日一题:力扣:225:用队列实现栈
Research and investment strategy report of China's VOCs catalyst industry (2022 Edition)
Seata聚合 AT、TCC、SAGA 、 XA事务模式打造一站式的分布式事务解决方案
MySQL数据库基本操作-DML
如何用程序确认当前系统的存储模式?