Part I. A Quick Overview of Visual C

Chapter 8 - Writing and Using Functions

Visual C++ 6: The Complete Reference
Chris H. Pappas and William H. Murray, III
  Copyright 1998 The McGraw-Hill Companies

Chapter 8: Writing and Using Functions
Overview
The cornerstone of C and C++ programming can be described in one word   functions. This chapter introduces the concept of a function and how it is  prototyped under the latest ANSI C standard. Many example programs will be used to examine the different types of functions and how arguments are passed. You will also learn how to use the standard C/C++ variables argc and argv to pass command-line arguments to the main( ) function. Additionally, this chapter explores several unique features available in C++.
Functions form the main building blocks of most C and C++ programs. Functions allow you to separate and code parts of your program in separate modules. Thus, functions allow your program to take on a modular appearance. Modular programming allows a program to be separated into workable parts that contribute to a final program form. For example, one function might be used to capture input data, another to print information, and yet another to write data to the disk. As a matter of fact, all C and C++ programming is done within a function. The one function every C or C++ program has is main( ).
You will find that C and C++ functions are similar to programming modules in other languages. For example, Pascal uses functions and procedures, while FORTRAN uses just functions. The proper development of functions determines, to a great extent, the efficiency, readability, and portability of your program code.
This chapter contains many programming examples that will show you how to create and implement a wide range of functions. Many of the example programs also use built-in C and C++ library functions that give your program extended power.

Books24x7.com, Inc 2000 –  


Visual C++ 6(c) The Complete Reference
Visual Studio 6: The Complete Reference
ISBN: B00007FYGA
EAN: N/A
Year: 1998
Pages: 207

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net