当前位置:网站首页>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 .
边栏推荐
- 自制J-Flash烧录工具——Qt调用jlinkARM.dll方式
- signed、unsigned关键字
- config:invalid signature 解决办法和问题排查详解
- 基於 QEMUv8 搭建 OP-TEE 開發環境
- Leetcode question brushing (XI) -- sequential questions brushing 51 to 55
- Spatial domain and frequency domain image compression of images
- const关键字
- 【LeetCode】19、 删除链表的倒数第 N 个结点
- NetXpert XG2帮您解决“布线安装与维护”难题
- 如何实现文字动画效果
猜你喜欢

Senior soft test (Information System Project Manager) high frequency test site: project quality management

Config:invalid signature solution and troubleshooting details

Signed and unsigned keywords

3DMAX assign face map

(十八)LCD1602实验

二分图判定

机试刷题1

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

Aardio - 通过变量名将变量值整合到一串文本中

在IPv6中 链路本地地址的优势
随机推荐
【雅思口语】安娜口语学习记录part1
Attack and defense world ditf Misc
Chapter 3: detailed explanation of class loading process (class life cycle)
每日一题:力扣:225:用队列实现栈
Web APIs DOM time object
柔性数组到底如何使用呢?
NetXpert XG2帮您解决“布线安装与维护”难题
云原生技术--- 容器知识点
CCNA Cisco network EIGRP protocol
2022-07-05 使用tpcc对stonedb进行子查询测试
Clip +json parsing converts the sound in the video into text
void关键字
第4章:再谈类的加载器
剑指offer刷题记录1
硬件开发笔记(十): 硬件开发基本流程,制作一个USB转RS232的模块(九):创建CH340G/MAX232封装库sop-16并关联原理图元器件
Report on technological progress and development prospects of solid oxide fuel cells in China (2022 Edition)
Web APIs DOM 时间对象
Heavyweight news | softing fg-200 has obtained China 3C explosion-proof certification to provide safety assurance for customers' on-site testing
Adavit -- dynamic network with adaptive selection of computing structure
(十八)LCD1602实验