32. Returning Data from Your Functions

In This Chapter

Returning values

Using the return data type

This chapter isn’t the end of your C learning—it’s only the beginning. Sounds deep, doesn’t it? This chapter completes the multiple-function picture by showing you how to return values from the called function to the calling function. It also explains function prototypes.

The bottom line is this: You will now understand why most programs in this book contain this line:

return 0;

You also will understand the true purpose of header files.

Returning Values

So far, you’ve seen how to send variables to functions. You’re now ready to learn how to return a value. When a function is to return a value, use the return statement to return the value. ...

Get C Programming Absolute Beginner’s Guide, Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.