Functios

Chandni Sengupta · 2012

This chapter discusses what functions are, why they are very important in organizing and maintaining C++ programs, and how to write and use them. A function is a short program or subprogram that works on a set of data and may return a value (an answer). One can keep his/her functions as long as one wants; however, it is more efficient to keep them short by limiting each function to do one specific, easily understood task. The function header and its body together are also called the implementation of the function. A function can return at most one value. In case a function does not return any value, then one has to indicate void as the return data type. A function can have no parameter to as many parameters as one need (separated by commas). The function does not have access to the variables used as arguments in the calling statement and cannot change them in any way.

Read the paper · More papers on PaperTik