当前位置:网站首页>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 .
边栏推荐
- Mise en place d'un environnement de développement OP - tee basé sur qemuv8
- Config:invalid signature solution and troubleshooting details
- Balanced Multimodal Learning via On-the-fly Gradient Modulation(CVPR2022 oral)
- 二分图判定
- UDP编程
- Classification, function and usage of MySQL constraints
- Gd32f4xx serial port receive interrupt and idle interrupt configuration
- Improving Multimodal Accuracy Through Modality Pre-training and Attention
- hdu 5077 NAND(暴力打表)
- 自定义 swap 函数
猜你喜欢

Assembly and Interface Technology Experiment 6 - ADDA conversion experiment, AD acquisition system in interrupt mode

MySQL数据库基本操作-DML

数据处理技巧(7):MATLAB 读取数字字符串混杂的文本文件txt中的数据

Leetcode exercise - Sword finger offer 26 Substructure of tree

Unity3d minigame-unity-webgl-transform插件转换微信小游戏报错To use dlopen, you need to use Emscripten‘s...问题
Learn the principle of database kernel from Oracle log parsing

软考高级(信息系统项目管理师)高频考点:项目质量管理
The SQL response is slow. What are your troubleshooting ideas?

PVL EDI 项目案例

将MySQL的表数据纯净方式导出
随机推荐
C# 三种方式实现Socket数据接收
[linear algebra] determinant of order 1.3 n
GD32F4XX串口接收中断和闲时中断配置
第4章:再谈类的加载器
NPDP certification | how do product managers communicate across functions / teams?
Comparison between variable and "zero value"
枚举与#define 宏的区别
Research and investment strategy report of China's VOCs catalyst industry (2022 Edition)
go多样化定时任务通用实现与封装
Improving Multimodal Accuracy Through Modality Pre-training and Attention
MySQL ---- first acquaintance with MySQL
extern关键字
使用云服务器搭建代理
0 basic learning C language - digital tube
Pit encountered by handwritten ABA
Assembly and interface technology experiment 5-8259 interrupt experiment
树的先序中序后序遍历
[线性代数] 1.3 n阶行列式
AdaViT——自适应选择计算结构的动态网络
poj 1094 Sorting It All Out (拓扑排序)