Chapter 5
Functions
Related Sections:Roberts,Chapter 5,P137
Today we start our study of functions in C. This is one of the most crucial parts of the language—something you will use in every program that you write. Even if you don’t define any new functions by yourself, main() is a function that has to be present in any complete C program.
Objectives
To understand the concept of calling a function and the reason for supplying arguments as part of the call.
To understand function prototypes and how to write them.
To be able to implement simple functions containing statements used in the previous chapters.
To be able to use the return statements to specify the result of a function
To understand the concept of a predicate functions and how to use them effectively.
To understand the relationship between formal parameters in a function and arguments in its caller.
Definition
A function is a set of statements that have been collected together and given a name.
A function body is always a block and therefore consists of statement enclosed in curly braces.
strcmp was not declared inFunctions
Functions from mathematics Functions from C libraries Writing your own functions
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论