O'Reilly logo

C Programming Absolute Beginner’s Guide, Third Edition by Dean Miller, Greg Perry

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required