CHAPTER

5

Modular Design and Functions

5.1 Introduction to Modular Programming

5.2 Functions

5.3 Computation Functions

5.4 Input and Output Functions

5.5 Recursive Functions

5.6 Sample Programs

Chapter Summary

Exercises

Objective

To divide and subdivide the problem into logical modules. The modules are written in C as manageable and meaningful units called functions.

The concept of modular programming was introduced in Chapters 1 and 2. Large and complex engineering and scientific problems require many lines of code to solve them. It is difficult for a programmer to write the code of a long program as a single unit or to debug and maintain a long program as a single unit. It is easier to find logic and execution errors in short modules. When ...

Get C Programming for Scientists and Engineers with Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.