Hosted by www.Geocities.ws

Hosted by www.Geocities.ws

                                                                 
               e-Learning Home      Tutorials        Site Map         Support                     Sunday May 13, 2007

 

FUNCTION: ORGANIZING THE PROGRAM 

As problems grow they become more difficult to solve.  One problem solving strategy is to break a problem into smaller problems (sub-problems) then solve each of the sub-problems separately. This idea of breaking a big problem into smaller ones is reminiscent of the old expression divide and conquer.  Similarly, a big program can be broken into subprograms that can be written and tested independently. Each of these subprograms is known as a function (unit) with a specific action (task) to perform. Normally, an application program (software) consists of thousands of lines of code (instructions).  Without an organization (function), it is almost impossible to write, test, use, maintain, or reuse a large program. Can you imagine a team of programmers trying to write and manage a program without using functions?    

TWO KINDS OF FUNCTIONS 

There are two kinds of functions:  built-in functions and user-defined functions.  A built-in function is pre-constructed and is available for use in your program. A user-defined function must be built by the programmer. 

C/C++ BUILT-IN FUNCTIONS

C/C++ comes with a library of functions that are pre-programmed and ready for use in your program. You are already familiar with the C built-in functions

 scanf(...), and printf (...), and the C++  function eof (...).

 

           

                                                                                

Contact Us              Locate School              Help              Term of Use              Web Security

©2007 F&M Art

Hosted by www.Geocities.ws

1