Sunday, August 12, 2012

Introduction to C++ Functions and Program Structure

Executing statements using C++ Functions, otherwise called methods or procedures in other programming languages makes it easy to structure a program by separating its tasks into self-contained units. One example of a C++ function is main function int main (). Because functions are written by the programmers, they are sometimes referred to as user-defined functions or programmer-defined functions. In definition terms, a C++ function is a block of statements that execute when called from some point of the program. Executed statements in C++ function are written once and are reused from several locations in a program, thus enabling its structuring. Statements for execution under one C++ Function  are hidden from other functions.

Executing statements using  C++ function helps to perform an assignment or a task that is required to complement full execution of the program. C++ functions enable us to structure the program but maintain its  flow and coordination.There are two kinds of C++ functions: built-in and user defined functions. The built-in C++ functions are usually in three categories: those which are part of the operating system, and others which are part of the C++ programming environment. The functionality or execution of the built-in C++ functions is normally the same irrespective of the source and the environment.

This tutorial will help you understand better the execution of statement using various forms of C++ functions, how to create one, how and when to use a function to structure a program. To declare a C++ function, you specify first its return type, i.e. the data type to be returned by the function. The return type is followed by the name or the identifier by which the function will be called. The C++ function name is followed by a pair of parentheses. Inside the the pair of parentheses also know as the parameter list area, can be left empty implying that the function will not receive any arguments or can include as many parameters as needed. To understand more on executing statements using C++ Functions, read more on introduction to C++ functions including details on, Declaration of functions, Function Prototype and Function Signatures, Argument Coercion, Argument Promotion Rules, and Void Function Or Function with no Return Type.