Chapter 7. Creating Your Own Functions

The bulk of programming involves using functions: performing set tasks by calling established procedures. C, like any language, has defined hundreds of functions used to simplify common steps. These range from the standard input/output ones like scanf() and printf() to specialized mathematical functions for trigonometry.

C also provides syntax for you to define your own functions. By doing so, you can encapsulate blocks of code under one name. This allows you to repeatedly execute that code through a simple function call. This move toward more modular programming is a key aspect to developing real-world applications.

In this chapter you'll learn everything you need to know about creating and using your own functions. For starters, you'll create simple functions, ones that take arguments, and ones that return values. Then you'll work your way into more complex subjects like inline and recursive functions. Finally, you'll learn about variable scope: understanding where variables exist.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset