- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
Engineering Computing I
Chapter 4
Functions and Program Structure
Functions
Spring 2011
2
Chapter 4
Functions break large computing tasks into smaller ones
Functions enable programmers to build on what others have
done instead of starting over from scratch.
Appropriate functions hide details of operation from parts of
the program that don’t need to know about them thus
clarifying the whole, and easing the pain of making changes.
C has been designed to make functions efficient and easy to
use
C programs generally consist of many small functions rather
than a few big ones.
Basics of Functions
Spring 2011
Chapter 4
3
To begin with, let us design and write a program to print each line of its input that contains a particular ‘‘pattern’’ or string of characters. (This is a special case of the UNIX program grep.) For example, searching for the pattern of letters ‘‘ould’’ in the set of lines
Ah Love! could you and I with Fate conspire
To grasp this sorry Scheme of Things entire,
Would not we shatter it to bits -- and then
Re-mould it nearer to the Heart’s Desire!
will produce the output
Ah Love! could you and I with Fate conspire
Would not we shatter it to bits -- and then
Re-mould it nearer to the Heart’s Desire!
Basics of Functions
Spring 2011
Chapter 4
4
Basics of Functions
Spring 2011
Chapter 4
5
Basics of Functions
Spring 2011
Chapter 4
6
Function Definition
Spring 2011
Chapter 4
7
Minimal Function
Functions Returning Non-integers
Spring 2011
Chapter 4
8
External Variables
Spring 2011
Chapter 4
9
A C program consists of a set of external objects, which are either variables or functions.
The adjective ‘‘external’’ is used in contrast to ‘‘internal’’, which describes the arguments and variables defined inside functions.
External variables are defined outside of any function, and are thus potentially available to many functions.
Functions themselves are always external, because C does not allow functions to be defined inside other
您可能关注的文档
- Emission Factor Modeling HoustonGalveston Area 排放因子模型休斯敦加尔维斯顿地区.ppt
- Emily Dickinson summit艾米丽狄金森峰会.k12.co.us.ppt
- Emotion Regulation, Behavioral Disinhibition, and Borderline情绪调节行为失控与边界.ppt
- Emission Spectra Mrs发射光谱夫人. Hoovler's Science Class.ppt
- Emission Spectra teachnlearnchem发射光谱 teachnlearnchem.ppt
- emographic Profile Back ground District – 27 dist emographic简介背景区27区–.ppt
- Emily Dickinson harrelllandharrellland狄金森.net.ppt
- Emotional Intelligence and Sporting Performance情绪智力与运动表现.ppt
- Emotional Intelligence in the Workplace York University工作场所情绪智力约克大学.ppt
- Emotionally Focused Therapy Connect情感集中的治疗连接.ppt
- Engineering 100 Bridge Project University of 工程100桥工程大学.ppt
- Engineering Economic Analysis 9th Edition工程经济分析第九版.ppt
- Engineering for Design Engineering Technology 工程设计工程技术.ppt
- Engine Parts, Description, Function, Construction发动机零件描述功能施工.ppt
- Engineering Controls oshainfo工程控制oshainfo.gatech.ppt
- Engineering Metabolism in Plant Cell Tissue Cultures 植物细胞组织培养中的工程代谢.ppt
- Engineering Graphics Academic Web Pages工程图学网页.ppt
- Engineering Problem Solving Course工程问题解决过程.ppt
- Engineering with Risk McKetta Department of 风险麦克塔工程部.ppt
- Engineering Photovoltaic Systems Appropedia工程光伏系统appropedia.ppt
文档评论(0)