ABSTRACT

This chapter describes how to create our own non-void function, that is, functions that return a value. The definition of a function that returns a value requires a return type other than void. The definition of a function that returns a value requires a return statement. Like a void function, any function that define to return a value can be called multiple times in the same program and any function that returns a value can be defined to have one or more parameters. The chapter explains new triangleArea() function from the setup() function. In the function call, it needs to supply int arguments that will become the values of the base and altitude parameter variables that have defined in the header of the triangleArea() function. In case of right triangle, the two legs can be used to specify the base and height of a triangle. The chapter illustrates how to use multiple void or non-void functions in the same program.